
obj/fs/fs:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 fe 1a 00 00       	call   801b2f <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <ide_wait_ready>:

static int diskno = 1;

static int
ide_wait_ready(bool check_error)
{
  800033:	55                   	push   %ebp
  800034:	89 e5                	mov    %esp,%ebp
  800036:	53                   	push   %ebx
  800037:	89 c1                	mov    %eax,%ecx

static inline uint8_t
inb(int port)
{
	uint8_t data;
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
  800039:	ba f7 01 00 00       	mov    $0x1f7,%edx
  80003e:	ec                   	in     (%dx),%al
  80003f:	89 c3                	mov    %eax,%ebx
	int r;

	while (((r = inb(0x1F7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
  800041:	83 e0 c0             	and    $0xffffffc0,%eax
  800044:	3c 40                	cmp    $0x40,%al
  800046:	75 f6                	jne    80003e <ide_wait_ready+0xb>
		/* do nothing */;

	if (check_error && (r & (IDE_DF|IDE_ERR)) != 0)
		return -1;
	return 0;
  800048:	b8 00 00 00 00       	mov    $0x0,%eax
	if (check_error && (r & (IDE_DF|IDE_ERR)) != 0)
  80004d:	84 c9                	test   %cl,%cl
  80004f:	74 0b                	je     80005c <ide_wait_ready+0x29>
  800051:	f6 c3 21             	test   $0x21,%bl
  800054:	0f 95 c0             	setne  %al
  800057:	0f b6 c0             	movzbl %al,%eax
  80005a:	f7 d8                	neg    %eax
}
  80005c:	5b                   	pop    %ebx
  80005d:	5d                   	pop    %ebp
  80005e:	c3                   	ret    

0080005f <ide_probe_disk1>:

bool
ide_probe_disk1(void)
{
  80005f:	f3 0f 1e fb          	endbr32 
  800063:	55                   	push   %ebp
  800064:	89 e5                	mov    %esp,%ebp
  800066:	53                   	push   %ebx
  800067:	83 ec 04             	sub    $0x4,%esp
	int r, x;

	// wait for Device 0 to be ready
	ide_wait_ready(0);
  80006a:	b8 00 00 00 00       	mov    $0x0,%eax
  80006f:	e8 bf ff ff ff       	call   800033 <ide_wait_ready>
}

static inline void
outb(int port, uint8_t data)
{
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
  800074:	b8 f0 ff ff ff       	mov    $0xfffffff0,%eax
  800079:	ba f6 01 00 00       	mov    $0x1f6,%edx
  80007e:	ee                   	out    %al,(%dx)

	// switch to Device 1
	outb(0x1F6, 0xE0 | (1<<4));

	// check for Device 1 to be ready for a while
	for (x = 0;
  80007f:	b9 00 00 00 00       	mov    $0x0,%ecx
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
  800084:	ba f7 01 00 00       	mov    $0x1f7,%edx
  800089:	ec                   	in     (%dx),%al
	     x < 1000 && ((r = inb(0x1F7)) & (IDE_BSY|IDE_DF|IDE_ERR)) != 0;
  80008a:	a8 a1                	test   $0xa1,%al
  80008c:	74 0b                	je     800099 <ide_probe_disk1+0x3a>
	     x++)
  80008e:	83 c1 01             	add    $0x1,%ecx
	for (x = 0;
  800091:	81 f9 e8 03 00 00    	cmp    $0x3e8,%ecx
  800097:	75 f0                	jne    800089 <ide_probe_disk1+0x2a>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
  800099:	b8 e0 ff ff ff       	mov    $0xffffffe0,%eax
  80009e:	ba f6 01 00 00       	mov    $0x1f6,%edx
  8000a3:	ee                   	out    %al,(%dx)
		/* do nothing */;

	// switch back to Device 0
	outb(0x1F6, 0xE0 | (0<<4));

	cprintf("Device 1 presence: %d\n", (x < 1000));
  8000a4:	81 f9 e7 03 00 00    	cmp    $0x3e7,%ecx
  8000aa:	0f 9e c3             	setle  %bl
  8000ad:	83 ec 08             	sub    $0x8,%esp
  8000b0:	0f b6 c3             	movzbl %bl,%eax
  8000b3:	50                   	push   %eax
  8000b4:	68 60 3a 80 00       	push   $0x803a60
  8000b9:	e8 ca 1b 00 00       	call   801c88 <cprintf>
	return (x < 1000);
}
  8000be:	89 d8                	mov    %ebx,%eax
  8000c0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8000c3:	c9                   	leave  
  8000c4:	c3                   	ret    

008000c5 <ide_set_disk>:

void
ide_set_disk(int d)
{
  8000c5:	f3 0f 1e fb          	endbr32 
  8000c9:	55                   	push   %ebp
  8000ca:	89 e5                	mov    %esp,%ebp
  8000cc:	83 ec 08             	sub    $0x8,%esp
  8000cf:	8b 45 08             	mov    0x8(%ebp),%eax
	if (d != 0 && d != 1)
  8000d2:	83 f8 01             	cmp    $0x1,%eax
  8000d5:	77 07                	ja     8000de <ide_set_disk+0x19>
		panic("bad disk number");
	diskno = d;
  8000d7:	a3 00 50 80 00       	mov    %eax,0x805000
}
  8000dc:	c9                   	leave  
  8000dd:	c3                   	ret    
		panic("bad disk number");
  8000de:	83 ec 04             	sub    $0x4,%esp
  8000e1:	68 77 3a 80 00       	push   $0x803a77
  8000e6:	6a 3a                	push   $0x3a
  8000e8:	68 87 3a 80 00       	push   $0x803a87
  8000ed:	e8 af 1a 00 00       	call   801ba1 <_panic>

008000f2 <ide_read>:


int
ide_read(uint32_t secno, void *dst, size_t nsecs)
{
  8000f2:	f3 0f 1e fb          	endbr32 
  8000f6:	55                   	push   %ebp
  8000f7:	89 e5                	mov    %esp,%ebp
  8000f9:	57                   	push   %edi
  8000fa:	56                   	push   %esi
  8000fb:	53                   	push   %ebx
  8000fc:	83 ec 0c             	sub    $0xc,%esp
  8000ff:	8b 7d 08             	mov    0x8(%ebp),%edi
  800102:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800105:	8b 75 10             	mov    0x10(%ebp),%esi
	int r;

	assert(nsecs <= 256);
  800108:	81 fe 00 01 00 00    	cmp    $0x100,%esi
  80010e:	77 60                	ja     800170 <ide_read+0x7e>

	ide_wait_ready(0);
  800110:	b8 00 00 00 00       	mov    $0x0,%eax
  800115:	e8 19 ff ff ff       	call   800033 <ide_wait_ready>
  80011a:	ba f2 01 00 00       	mov    $0x1f2,%edx
  80011f:	89 f0                	mov    %esi,%eax
  800121:	ee                   	out    %al,(%dx)
  800122:	ba f3 01 00 00       	mov    $0x1f3,%edx
  800127:	89 f8                	mov    %edi,%eax
  800129:	ee                   	out    %al,(%dx)

	outb(0x1F2, nsecs);
	outb(0x1F3, secno & 0xFF);
	outb(0x1F4, (secno >> 8) & 0xFF);
  80012a:	89 f8                	mov    %edi,%eax
  80012c:	c1 e8 08             	shr    $0x8,%eax
  80012f:	ba f4 01 00 00       	mov    $0x1f4,%edx
  800134:	ee                   	out    %al,(%dx)
	outb(0x1F5, (secno >> 16) & 0xFF);
  800135:	89 f8                	mov    %edi,%eax
  800137:	c1 e8 10             	shr    $0x10,%eax
  80013a:	ba f5 01 00 00       	mov    $0x1f5,%edx
  80013f:	ee                   	out    %al,(%dx)
	outb(0x1F6, 0xE0 | ((diskno&1)<<4) | ((secno>>24)&0x0F));
  800140:	0f b6 05 00 50 80 00 	movzbl 0x805000,%eax
  800147:	c1 e0 04             	shl    $0x4,%eax
  80014a:	83 e0 10             	and    $0x10,%eax
  80014d:	c1 ef 18             	shr    $0x18,%edi
  800150:	83 e7 0f             	and    $0xf,%edi
  800153:	09 f8                	or     %edi,%eax
  800155:	83 c8 e0             	or     $0xffffffe0,%eax
  800158:	ba f6 01 00 00       	mov    $0x1f6,%edx
  80015d:	ee                   	out    %al,(%dx)
  80015e:	b8 20 00 00 00       	mov    $0x20,%eax
  800163:	ba f7 01 00 00       	mov    $0x1f7,%edx
  800168:	ee                   	out    %al,(%dx)
  800169:	c1 e6 09             	shl    $0x9,%esi
  80016c:	01 de                	add    %ebx,%esi
}
  80016e:	eb 2b                	jmp    80019b <ide_read+0xa9>
	assert(nsecs <= 256);
  800170:	68 90 3a 80 00       	push   $0x803a90
  800175:	68 9d 3a 80 00       	push   $0x803a9d
  80017a:	6a 44                	push   $0x44
  80017c:	68 87 3a 80 00       	push   $0x803a87
  800181:	e8 1b 1a 00 00       	call   801ba1 <_panic>
	asm volatile("cld\n\trepne\n\tinsl"
  800186:	89 df                	mov    %ebx,%edi
  800188:	b9 80 00 00 00       	mov    $0x80,%ecx
  80018d:	ba f0 01 00 00       	mov    $0x1f0,%edx
  800192:	fc                   	cld    
  800193:	f2 6d                	repnz insl (%dx),%es:(%edi)
	outb(0x1F7, 0x20);	// CMD 0x20 means read sector

	for (; nsecs > 0; nsecs--, dst += SECTSIZE) {
  800195:	81 c3 00 02 00 00    	add    $0x200,%ebx
  80019b:	39 f3                	cmp    %esi,%ebx
  80019d:	74 10                	je     8001af <ide_read+0xbd>
		if ((r = ide_wait_ready(1)) < 0)
  80019f:	b8 01 00 00 00       	mov    $0x1,%eax
  8001a4:	e8 8a fe ff ff       	call   800033 <ide_wait_ready>
  8001a9:	85 c0                	test   %eax,%eax
  8001ab:	79 d9                	jns    800186 <ide_read+0x94>
  8001ad:	eb 05                	jmp    8001b4 <ide_read+0xc2>
			return r;
		insl(0x1F0, dst, SECTSIZE/4);
	}

	return 0;
  8001af:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8001b4:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8001b7:	5b                   	pop    %ebx
  8001b8:	5e                   	pop    %esi
  8001b9:	5f                   	pop    %edi
  8001ba:	5d                   	pop    %ebp
  8001bb:	c3                   	ret    

008001bc <ide_write>:

int
ide_write(uint32_t secno, const void *src, size_t nsecs)
{
  8001bc:	f3 0f 1e fb          	endbr32 
  8001c0:	55                   	push   %ebp
  8001c1:	89 e5                	mov    %esp,%ebp
  8001c3:	57                   	push   %edi
  8001c4:	56                   	push   %esi
  8001c5:	53                   	push   %ebx
  8001c6:	83 ec 0c             	sub    $0xc,%esp
  8001c9:	8b 75 08             	mov    0x8(%ebp),%esi
  8001cc:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8001cf:	8b 7d 10             	mov    0x10(%ebp),%edi
	int r;

	assert(nsecs <= 256);
  8001d2:	81 ff 00 01 00 00    	cmp    $0x100,%edi
  8001d8:	77 60                	ja     80023a <ide_write+0x7e>

	ide_wait_ready(0);
  8001da:	b8 00 00 00 00       	mov    $0x0,%eax
  8001df:	e8 4f fe ff ff       	call   800033 <ide_wait_ready>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
  8001e4:	ba f2 01 00 00       	mov    $0x1f2,%edx
  8001e9:	89 f8                	mov    %edi,%eax
  8001eb:	ee                   	out    %al,(%dx)
  8001ec:	ba f3 01 00 00       	mov    $0x1f3,%edx
  8001f1:	89 f0                	mov    %esi,%eax
  8001f3:	ee                   	out    %al,(%dx)

	outb(0x1F2, nsecs);
	outb(0x1F3, secno & 0xFF);
	outb(0x1F4, (secno >> 8) & 0xFF);
  8001f4:	89 f0                	mov    %esi,%eax
  8001f6:	c1 e8 08             	shr    $0x8,%eax
  8001f9:	ba f4 01 00 00       	mov    $0x1f4,%edx
  8001fe:	ee                   	out    %al,(%dx)
	outb(0x1F5, (secno >> 16) & 0xFF);
  8001ff:	89 f0                	mov    %esi,%eax
  800201:	c1 e8 10             	shr    $0x10,%eax
  800204:	ba f5 01 00 00       	mov    $0x1f5,%edx
  800209:	ee                   	out    %al,(%dx)
	outb(0x1F6, 0xE0 | ((diskno&1)<<4) | ((secno>>24)&0x0F));
  80020a:	0f b6 05 00 50 80 00 	movzbl 0x805000,%eax
  800211:	c1 e0 04             	shl    $0x4,%eax
  800214:	83 e0 10             	and    $0x10,%eax
  800217:	c1 ee 18             	shr    $0x18,%esi
  80021a:	83 e6 0f             	and    $0xf,%esi
  80021d:	09 f0                	or     %esi,%eax
  80021f:	83 c8 e0             	or     $0xffffffe0,%eax
  800222:	ba f6 01 00 00       	mov    $0x1f6,%edx
  800227:	ee                   	out    %al,(%dx)
  800228:	b8 30 00 00 00       	mov    $0x30,%eax
  80022d:	ba f7 01 00 00       	mov    $0x1f7,%edx
  800232:	ee                   	out    %al,(%dx)
  800233:	c1 e7 09             	shl    $0x9,%edi
  800236:	01 df                	add    %ebx,%edi
}
  800238:	eb 2b                	jmp    800265 <ide_write+0xa9>
	assert(nsecs <= 256);
  80023a:	68 90 3a 80 00       	push   $0x803a90
  80023f:	68 9d 3a 80 00       	push   $0x803a9d
  800244:	6a 5d                	push   $0x5d
  800246:	68 87 3a 80 00       	push   $0x803a87
  80024b:	e8 51 19 00 00       	call   801ba1 <_panic>
}

static inline void
outsl(int port, const void *addr, int cnt)
{
	asm volatile("cld\n\trepne\n\toutsl"
  800250:	89 de                	mov    %ebx,%esi
  800252:	b9 80 00 00 00       	mov    $0x80,%ecx
  800257:	ba f0 01 00 00       	mov    $0x1f0,%edx
  80025c:	fc                   	cld    
  80025d:	f2 6f                	repnz outsl %ds:(%esi),(%dx)
	outb(0x1F7, 0x30);	// CMD 0x30 means write sector

	for (; nsecs > 0; nsecs--, src += SECTSIZE) {
  80025f:	81 c3 00 02 00 00    	add    $0x200,%ebx
  800265:	39 fb                	cmp    %edi,%ebx
  800267:	74 10                	je     800279 <ide_write+0xbd>
		if ((r = ide_wait_ready(1)) < 0)
  800269:	b8 01 00 00 00       	mov    $0x1,%eax
  80026e:	e8 c0 fd ff ff       	call   800033 <ide_wait_ready>
  800273:	85 c0                	test   %eax,%eax
  800275:	79 d9                	jns    800250 <ide_write+0x94>
  800277:	eb 05                	jmp    80027e <ide_write+0xc2>
			return r;
		outsl(0x1F0, src, SECTSIZE/4);
	}

	return 0;
  800279:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80027e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800281:	5b                   	pop    %ebx
  800282:	5e                   	pop    %esi
  800283:	5f                   	pop    %edi
  800284:	5d                   	pop    %ebp
  800285:	c3                   	ret    

00800286 <bc_pgfault>:

// Fault any disk block that is read in to memory by
// loading it from disk.
static void
bc_pgfault(struct UTrapframe *utf)
{
  800286:	f3 0f 1e fb          	endbr32 
  80028a:	55                   	push   %ebp
  80028b:	89 e5                	mov    %esp,%ebp
  80028d:	56                   	push   %esi
  80028e:	53                   	push   %ebx
  80028f:	8b 55 08             	mov    0x8(%ebp),%edx
	void *addr = (void *) utf->utf_fault_va;
  800292:	8b 1a                	mov    (%edx),%ebx
	uint32_t blockno = ((uint32_t)addr - DISKMAP) / BLKSIZE;
  800294:	8d 83 00 00 00 f0    	lea    -0x10000000(%ebx),%eax
  80029a:	89 c6                	mov    %eax,%esi
  80029c:	c1 ee 0c             	shr    $0xc,%esi
	int r;

	// Check that the fault was within the block cache region
	if (addr < (void*)DISKMAP || addr >= (void*)(DISKMAP + DISKSIZE))
  80029f:	3d ff ff ff bf       	cmp    $0xbfffffff,%eax
  8002a4:	0f 87 95 00 00 00    	ja     80033f <bc_pgfault+0xb9>
		panic("page fault in FS: eip %08x, va %08x, err %04x",
		      utf->utf_eip, addr, utf->utf_err);

	// Sanity check the block number.
	if (super && blockno >= super->s_nblocks)
  8002aa:	a1 08 a0 80 00       	mov    0x80a008,%eax
  8002af:	85 c0                	test   %eax,%eax
  8002b1:	74 09                	je     8002bc <bc_pgfault+0x36>
  8002b3:	39 70 04             	cmp    %esi,0x4(%eax)
  8002b6:	0f 86 9e 00 00 00    	jbe    80035a <bc_pgfault+0xd4>
	// of the block from the disk into that page.
	// Hint: first round addr to page boundary. fs/ide.c has code to read
	// the disk.
	//
	// LAB 5: you code here:
	addr=ROUNDDOWN(addr,PGSIZE);
  8002bc:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	if((r = sys_page_alloc(0,addr,(PTE_U|PTE_P|PTE_W)))<0){
  8002c2:	83 ec 04             	sub    $0x4,%esp
  8002c5:	6a 07                	push   $0x7
  8002c7:	53                   	push   %ebx
  8002c8:	6a 00                	push   $0x0
  8002ca:	e8 d4 23 00 00       	call   8026a3 <sys_page_alloc>
  8002cf:	83 c4 10             	add    $0x10,%esp
  8002d2:	85 c0                	test   %eax,%eax
  8002d4:	0f 88 92 00 00 00    	js     80036c <bc_pgfault+0xe6>
		panic("sys_page_alloc:%e\n",r);
	}
	//内存中缺少块blockno，因此对应着disk中的扇区blockno*BLKSECTS=blockno*8
	//8个扇区为一个块，因此要读取BLKSECTS=8个扇区，才可以完全加载完blockno块到内存中
	if((r=ide_read(blockno*BLKSECTS,addr,BLKSECTS))<0){
  8002da:	83 ec 04             	sub    $0x4,%esp
  8002dd:	6a 08                	push   $0x8
  8002df:	53                   	push   %ebx
  8002e0:	8d 04 f5 00 00 00 00 	lea    0x0(,%esi,8),%eax
  8002e7:	50                   	push   %eax
  8002e8:	e8 05 fe ff ff       	call   8000f2 <ide_read>
  8002ed:	83 c4 10             	add    $0x10,%esp
  8002f0:	85 c0                	test   %eax,%eax
  8002f2:	0f 88 86 00 00 00    	js     80037e <bc_pgfault+0xf8>
		panic("ide_read:%e\n",r);
	}

	// Clear the dirty bit for the disk block page since we just read the
	// block from disk
	if ((r = sys_page_map(0, addr, 0, addr, uvpt[PGNUM(addr)] & PTE_SYSCALL)) < 0)
  8002f8:	89 d8                	mov    %ebx,%eax
  8002fa:	c1 e8 0c             	shr    $0xc,%eax
  8002fd:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  800304:	83 ec 0c             	sub    $0xc,%esp
  800307:	25 07 0e 00 00       	and    $0xe07,%eax
  80030c:	50                   	push   %eax
  80030d:	53                   	push   %ebx
  80030e:	6a 00                	push   $0x0
  800310:	53                   	push   %ebx
  800311:	6a 00                	push   $0x0
  800313:	e8 d2 23 00 00       	call   8026ea <sys_page_map>
  800318:	83 c4 20             	add    $0x20,%esp
  80031b:	85 c0                	test   %eax,%eax
  80031d:	78 71                	js     800390 <bc_pgfault+0x10a>
		panic("in bc_pgfault, sys_page_map: %e", r);

	// Check that the block we read was allocated. (exercise for
	// the reader: why do we do this *after* reading the block
	// in?)
	if (bitmap && block_is_free(blockno))
  80031f:	83 3d 04 a0 80 00 00 	cmpl   $0x0,0x80a004
  800326:	74 10                	je     800338 <bc_pgfault+0xb2>
  800328:	83 ec 0c             	sub    $0xc,%esp
  80032b:	56                   	push   %esi
  80032c:	e8 1e 05 00 00       	call   80084f <block_is_free>
  800331:	83 c4 10             	add    $0x10,%esp
  800334:	84 c0                	test   %al,%al
  800336:	75 6a                	jne    8003a2 <bc_pgfault+0x11c>
		panic("reading free block %08x\n", blockno);
}
  800338:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80033b:	5b                   	pop    %ebx
  80033c:	5e                   	pop    %esi
  80033d:	5d                   	pop    %ebp
  80033e:	c3                   	ret    
		panic("page fault in FS: eip %08x, va %08x, err %04x",
  80033f:	83 ec 08             	sub    $0x8,%esp
  800342:	ff 72 04             	pushl  0x4(%edx)
  800345:	53                   	push   %ebx
  800346:	ff 72 28             	pushl  0x28(%edx)
  800349:	68 b4 3a 80 00       	push   $0x803ab4
  80034e:	6a 26                	push   $0x26
  800350:	68 90 3b 80 00       	push   $0x803b90
  800355:	e8 47 18 00 00       	call   801ba1 <_panic>
		panic("reading non-existent block %08x\n", blockno);
  80035a:	56                   	push   %esi
  80035b:	68 e4 3a 80 00       	push   $0x803ae4
  800360:	6a 2b                	push   $0x2b
  800362:	68 90 3b 80 00       	push   $0x803b90
  800367:	e8 35 18 00 00       	call   801ba1 <_panic>
		panic("sys_page_alloc:%e\n",r);
  80036c:	50                   	push   %eax
  80036d:	68 98 3b 80 00       	push   $0x803b98
  800372:	6a 35                	push   $0x35
  800374:	68 90 3b 80 00       	push   $0x803b90
  800379:	e8 23 18 00 00       	call   801ba1 <_panic>
		panic("ide_read:%e\n",r);
  80037e:	50                   	push   %eax
  80037f:	68 ab 3b 80 00       	push   $0x803bab
  800384:	6a 3a                	push   $0x3a
  800386:	68 90 3b 80 00       	push   $0x803b90
  80038b:	e8 11 18 00 00       	call   801ba1 <_panic>
		panic("in bc_pgfault, sys_page_map: %e", r);
  800390:	50                   	push   %eax
  800391:	68 08 3b 80 00       	push   $0x803b08
  800396:	6a 40                	push   $0x40
  800398:	68 90 3b 80 00       	push   $0x803b90
  80039d:	e8 ff 17 00 00       	call   801ba1 <_panic>
		panic("reading free block %08x\n", blockno);
  8003a2:	56                   	push   %esi
  8003a3:	68 b8 3b 80 00       	push   $0x803bb8
  8003a8:	6a 46                	push   $0x46
  8003aa:	68 90 3b 80 00       	push   $0x803b90
  8003af:	e8 ed 17 00 00       	call   801ba1 <_panic>

008003b4 <diskaddr>:
{
  8003b4:	f3 0f 1e fb          	endbr32 
  8003b8:	55                   	push   %ebp
  8003b9:	89 e5                	mov    %esp,%ebp
  8003bb:	83 ec 08             	sub    $0x8,%esp
  8003be:	8b 45 08             	mov    0x8(%ebp),%eax
	if (blockno == 0 || (super && blockno >= super->s_nblocks))
  8003c1:	85 c0                	test   %eax,%eax
  8003c3:	74 19                	je     8003de <diskaddr+0x2a>
  8003c5:	8b 15 08 a0 80 00    	mov    0x80a008,%edx
  8003cb:	85 d2                	test   %edx,%edx
  8003cd:	74 05                	je     8003d4 <diskaddr+0x20>
  8003cf:	39 42 04             	cmp    %eax,0x4(%edx)
  8003d2:	76 0a                	jbe    8003de <diskaddr+0x2a>
	return (char*) (DISKMAP + blockno * BLKSIZE);
  8003d4:	05 00 00 01 00       	add    $0x10000,%eax
  8003d9:	c1 e0 0c             	shl    $0xc,%eax
}
  8003dc:	c9                   	leave  
  8003dd:	c3                   	ret    
		panic("bad block number %08x in diskaddr", blockno);
  8003de:	50                   	push   %eax
  8003df:	68 28 3b 80 00       	push   $0x803b28
  8003e4:	6a 09                	push   $0x9
  8003e6:	68 90 3b 80 00       	push   $0x803b90
  8003eb:	e8 b1 17 00 00       	call   801ba1 <_panic>

008003f0 <va_is_mapped>:
{
  8003f0:	f3 0f 1e fb          	endbr32 
  8003f4:	55                   	push   %ebp
  8003f5:	89 e5                	mov    %esp,%ebp
  8003f7:	8b 55 08             	mov    0x8(%ebp),%edx
	return (uvpd[PDX(va)] & PTE_P) && (uvpt[PGNUM(va)] & PTE_P);
  8003fa:	89 d0                	mov    %edx,%eax
  8003fc:	c1 e8 16             	shr    $0x16,%eax
  8003ff:	8b 0c 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%ecx
  800406:	b8 00 00 00 00       	mov    $0x0,%eax
  80040b:	f6 c1 01             	test   $0x1,%cl
  80040e:	74 0d                	je     80041d <va_is_mapped+0x2d>
  800410:	c1 ea 0c             	shr    $0xc,%edx
  800413:	8b 04 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%eax
  80041a:	83 e0 01             	and    $0x1,%eax
  80041d:	83 e0 01             	and    $0x1,%eax
}
  800420:	5d                   	pop    %ebp
  800421:	c3                   	ret    

00800422 <va_is_dirty>:
{
  800422:	f3 0f 1e fb          	endbr32 
  800426:	55                   	push   %ebp
  800427:	89 e5                	mov    %esp,%ebp
	return (uvpt[PGNUM(va)] & PTE_D) != 0;
  800429:	8b 45 08             	mov    0x8(%ebp),%eax
  80042c:	c1 e8 0c             	shr    $0xc,%eax
  80042f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  800436:	c1 e8 06             	shr    $0x6,%eax
  800439:	83 e0 01             	and    $0x1,%eax
}
  80043c:	5d                   	pop    %ebp
  80043d:	c3                   	ret    

0080043e <flush_block>:
// Hint: Use va_is_mapped, va_is_dirty, and ide_write.
// Hint: Use the PTE_SYSCALL constant when calling sys_page_map.
// Hint: Don't forget to round addr down.
void
flush_block(void *addr)
{
  80043e:	f3 0f 1e fb          	endbr32 
  800442:	55                   	push   %ebp
  800443:	89 e5                	mov    %esp,%ebp
  800445:	56                   	push   %esi
  800446:	53                   	push   %ebx
  800447:	8b 5d 08             	mov    0x8(%ebp),%ebx
	uint32_t blockno = ((uint32_t)addr - DISKMAP) / BLKSIZE;
  80044a:	8d b3 00 00 00 f0    	lea    -0x10000000(%ebx),%esi

	if (addr < (void*)DISKMAP || addr >= (void*)(DISKMAP + DISKSIZE))
  800450:	81 fe ff ff ff bf    	cmp    $0xbfffffff,%esi
  800456:	77 1d                	ja     800475 <flush_block+0x37>
		panic("flush_block of bad va %08x", addr);

	// LAB 5: Your code here.
	int r;
	addr = ROUNDDOWN(addr,PGSIZE);
  800458:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	if (!va_is_mapped(addr) || ! va_is_dirty(addr)) {
  80045e:	83 ec 0c             	sub    $0xc,%esp
  800461:	53                   	push   %ebx
  800462:	e8 89 ff ff ff       	call   8003f0 <va_is_mapped>
  800467:	83 c4 10             	add    $0x10,%esp
  80046a:	84 c0                	test   %al,%al
  80046c:	75 19                	jne    800487 <flush_block+0x49>
		panic("in flush block ,ide_write() :%e",r);
	}
	if ((r = sys_page_map(0,addr,0,addr,uvpt[PGNUM(addr)] & PTE_SYSCALL) ) < 0 ) {
		panic("sys_page_map error : %e",r);
	}
}
  80046e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800471:	5b                   	pop    %ebx
  800472:	5e                   	pop    %esi
  800473:	5d                   	pop    %ebp
  800474:	c3                   	ret    
		panic("flush_block of bad va %08x", addr);
  800475:	53                   	push   %ebx
  800476:	68 d1 3b 80 00       	push   $0x803bd1
  80047b:	6a 56                	push   $0x56
  80047d:	68 90 3b 80 00       	push   $0x803b90
  800482:	e8 1a 17 00 00       	call   801ba1 <_panic>
	if (!va_is_mapped(addr) || ! va_is_dirty(addr)) {
  800487:	83 ec 0c             	sub    $0xc,%esp
  80048a:	53                   	push   %ebx
  80048b:	e8 92 ff ff ff       	call   800422 <va_is_dirty>
  800490:	83 c4 10             	add    $0x10,%esp
  800493:	84 c0                	test   %al,%al
  800495:	74 d7                	je     80046e <flush_block+0x30>
	if ((r = ide_write(blockno * BLKSECTS,addr,BLKSECTS)) < 0 ) {
  800497:	83 ec 04             	sub    $0x4,%esp
  80049a:	6a 08                	push   $0x8
  80049c:	53                   	push   %ebx
	uint32_t blockno = ((uint32_t)addr - DISKMAP) / BLKSIZE;
  80049d:	c1 ee 0c             	shr    $0xc,%esi
	if ((r = ide_write(blockno * BLKSECTS,addr,BLKSECTS)) < 0 ) {
  8004a0:	c1 e6 03             	shl    $0x3,%esi
  8004a3:	56                   	push   %esi
  8004a4:	e8 13 fd ff ff       	call   8001bc <ide_write>
  8004a9:	83 c4 10             	add    $0x10,%esp
  8004ac:	85 c0                	test   %eax,%eax
  8004ae:	78 39                	js     8004e9 <flush_block+0xab>
	if ((r = sys_page_map(0,addr,0,addr,uvpt[PGNUM(addr)] & PTE_SYSCALL) ) < 0 ) {
  8004b0:	89 d8                	mov    %ebx,%eax
  8004b2:	c1 e8 0c             	shr    $0xc,%eax
  8004b5:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8004bc:	83 ec 0c             	sub    $0xc,%esp
  8004bf:	25 07 0e 00 00       	and    $0xe07,%eax
  8004c4:	50                   	push   %eax
  8004c5:	53                   	push   %ebx
  8004c6:	6a 00                	push   $0x0
  8004c8:	53                   	push   %ebx
  8004c9:	6a 00                	push   $0x0
  8004cb:	e8 1a 22 00 00       	call   8026ea <sys_page_map>
  8004d0:	83 c4 20             	add    $0x20,%esp
  8004d3:	85 c0                	test   %eax,%eax
  8004d5:	79 97                	jns    80046e <flush_block+0x30>
		panic("sys_page_map error : %e",r);
  8004d7:	50                   	push   %eax
  8004d8:	68 ec 3b 80 00       	push   $0x803bec
  8004dd:	6a 62                	push   $0x62
  8004df:	68 90 3b 80 00       	push   $0x803b90
  8004e4:	e8 b8 16 00 00       	call   801ba1 <_panic>
		panic("in flush block ,ide_write() :%e",r);
  8004e9:	50                   	push   %eax
  8004ea:	68 4c 3b 80 00       	push   $0x803b4c
  8004ef:	6a 5f                	push   $0x5f
  8004f1:	68 90 3b 80 00       	push   $0x803b90
  8004f6:	e8 a6 16 00 00       	call   801ba1 <_panic>

008004fb <bc_init>:
	cprintf("block cache is good\n");
}

void
bc_init(void)
{
  8004fb:	f3 0f 1e fb          	endbr32 
  8004ff:	55                   	push   %ebp
  800500:	89 e5                	mov    %esp,%ebp
  800502:	53                   	push   %ebx
  800503:	81 ec 20 02 00 00    	sub    $0x220,%esp
	struct Super super;
	set_pgfault_handler(bc_pgfault);
  800509:	68 86 02 80 00       	push   $0x800286
  80050e:	e8 a1 23 00 00       	call   8028b4 <set_pgfault_handler>
	memmove(&backup, diskaddr(1), sizeof backup);
  800513:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80051a:	e8 95 fe ff ff       	call   8003b4 <diskaddr>
  80051f:	83 c4 0c             	add    $0xc,%esp
  800522:	68 08 01 00 00       	push   $0x108
  800527:	50                   	push   %eax
  800528:	8d 85 e8 fd ff ff    	lea    -0x218(%ebp),%eax
  80052e:	50                   	push   %eax
  80052f:	e8 e3 1e 00 00       	call   802417 <memmove>
	strcpy(diskaddr(1), "OOPS!\n");
  800534:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80053b:	e8 74 fe ff ff       	call   8003b4 <diskaddr>
  800540:	83 c4 08             	add    $0x8,%esp
  800543:	68 04 3c 80 00       	push   $0x803c04
  800548:	50                   	push   %eax
  800549:	e8 13 1d 00 00       	call   802261 <strcpy>
	flush_block(diskaddr(1));
  80054e:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800555:	e8 5a fe ff ff       	call   8003b4 <diskaddr>
  80055a:	89 04 24             	mov    %eax,(%esp)
  80055d:	e8 dc fe ff ff       	call   80043e <flush_block>
	assert(va_is_mapped(diskaddr(1)));
  800562:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800569:	e8 46 fe ff ff       	call   8003b4 <diskaddr>
  80056e:	89 04 24             	mov    %eax,(%esp)
  800571:	e8 7a fe ff ff       	call   8003f0 <va_is_mapped>
  800576:	83 c4 10             	add    $0x10,%esp
  800579:	84 c0                	test   %al,%al
  80057b:	0f 84 d1 01 00 00    	je     800752 <bc_init+0x257>
	assert(!va_is_dirty(diskaddr(1)));
  800581:	83 ec 0c             	sub    $0xc,%esp
  800584:	6a 01                	push   $0x1
  800586:	e8 29 fe ff ff       	call   8003b4 <diskaddr>
  80058b:	89 04 24             	mov    %eax,(%esp)
  80058e:	e8 8f fe ff ff       	call   800422 <va_is_dirty>
  800593:	83 c4 10             	add    $0x10,%esp
  800596:	84 c0                	test   %al,%al
  800598:	0f 85 ca 01 00 00    	jne    800768 <bc_init+0x26d>
	sys_page_unmap(0, diskaddr(1));
  80059e:	83 ec 0c             	sub    $0xc,%esp
  8005a1:	6a 01                	push   $0x1
  8005a3:	e8 0c fe ff ff       	call   8003b4 <diskaddr>
  8005a8:	83 c4 08             	add    $0x8,%esp
  8005ab:	50                   	push   %eax
  8005ac:	6a 00                	push   $0x0
  8005ae:	e8 7d 21 00 00       	call   802730 <sys_page_unmap>
	assert(!va_is_mapped(diskaddr(1)));
  8005b3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  8005ba:	e8 f5 fd ff ff       	call   8003b4 <diskaddr>
  8005bf:	89 04 24             	mov    %eax,(%esp)
  8005c2:	e8 29 fe ff ff       	call   8003f0 <va_is_mapped>
  8005c7:	83 c4 10             	add    $0x10,%esp
  8005ca:	84 c0                	test   %al,%al
  8005cc:	0f 85 ac 01 00 00    	jne    80077e <bc_init+0x283>
	assert(strcmp(diskaddr(1), "OOPS!\n") == 0);
  8005d2:	83 ec 0c             	sub    $0xc,%esp
  8005d5:	6a 01                	push   $0x1
  8005d7:	e8 d8 fd ff ff       	call   8003b4 <diskaddr>
  8005dc:	83 c4 08             	add    $0x8,%esp
  8005df:	68 04 3c 80 00       	push   $0x803c04
  8005e4:	50                   	push   %eax
  8005e5:	e8 36 1d 00 00       	call   802320 <strcmp>
  8005ea:	83 c4 10             	add    $0x10,%esp
  8005ed:	85 c0                	test   %eax,%eax
  8005ef:	0f 85 9f 01 00 00    	jne    800794 <bc_init+0x299>
	memmove(diskaddr(1), &backup, sizeof backup);
  8005f5:	83 ec 0c             	sub    $0xc,%esp
  8005f8:	6a 01                	push   $0x1
  8005fa:	e8 b5 fd ff ff       	call   8003b4 <diskaddr>
  8005ff:	83 c4 0c             	add    $0xc,%esp
  800602:	68 08 01 00 00       	push   $0x108
  800607:	8d 9d e8 fd ff ff    	lea    -0x218(%ebp),%ebx
  80060d:	53                   	push   %ebx
  80060e:	50                   	push   %eax
  80060f:	e8 03 1e 00 00       	call   802417 <memmove>
	flush_block(diskaddr(1));
  800614:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80061b:	e8 94 fd ff ff       	call   8003b4 <diskaddr>
  800620:	89 04 24             	mov    %eax,(%esp)
  800623:	e8 16 fe ff ff       	call   80043e <flush_block>
	memmove(&backup, diskaddr(1), sizeof backup);
  800628:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80062f:	e8 80 fd ff ff       	call   8003b4 <diskaddr>
  800634:	83 c4 0c             	add    $0xc,%esp
  800637:	68 08 01 00 00       	push   $0x108
  80063c:	50                   	push   %eax
  80063d:	53                   	push   %ebx
  80063e:	e8 d4 1d 00 00       	call   802417 <memmove>
	strcpy(diskaddr(1), "OOPS!\n");
  800643:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80064a:	e8 65 fd ff ff       	call   8003b4 <diskaddr>
  80064f:	83 c4 08             	add    $0x8,%esp
  800652:	68 04 3c 80 00       	push   $0x803c04
  800657:	50                   	push   %eax
  800658:	e8 04 1c 00 00       	call   802261 <strcpy>
	flush_block(diskaddr(1) + 20);
  80065d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800664:	e8 4b fd ff ff       	call   8003b4 <diskaddr>
  800669:	83 c0 14             	add    $0x14,%eax
  80066c:	89 04 24             	mov    %eax,(%esp)
  80066f:	e8 ca fd ff ff       	call   80043e <flush_block>
	assert(va_is_mapped(diskaddr(1)));
  800674:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80067b:	e8 34 fd ff ff       	call   8003b4 <diskaddr>
  800680:	89 04 24             	mov    %eax,(%esp)
  800683:	e8 68 fd ff ff       	call   8003f0 <va_is_mapped>
  800688:	83 c4 10             	add    $0x10,%esp
  80068b:	84 c0                	test   %al,%al
  80068d:	0f 84 17 01 00 00    	je     8007aa <bc_init+0x2af>
	sys_page_unmap(0, diskaddr(1));
  800693:	83 ec 0c             	sub    $0xc,%esp
  800696:	6a 01                	push   $0x1
  800698:	e8 17 fd ff ff       	call   8003b4 <diskaddr>
  80069d:	83 c4 08             	add    $0x8,%esp
  8006a0:	50                   	push   %eax
  8006a1:	6a 00                	push   $0x0
  8006a3:	e8 88 20 00 00       	call   802730 <sys_page_unmap>
	assert(!va_is_mapped(diskaddr(1)));
  8006a8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  8006af:	e8 00 fd ff ff       	call   8003b4 <diskaddr>
  8006b4:	89 04 24             	mov    %eax,(%esp)
  8006b7:	e8 34 fd ff ff       	call   8003f0 <va_is_mapped>
  8006bc:	83 c4 10             	add    $0x10,%esp
  8006bf:	84 c0                	test   %al,%al
  8006c1:	0f 85 fc 00 00 00    	jne    8007c3 <bc_init+0x2c8>
	assert(strcmp(diskaddr(1), "OOPS!\n") == 0);
  8006c7:	83 ec 0c             	sub    $0xc,%esp
  8006ca:	6a 01                	push   $0x1
  8006cc:	e8 e3 fc ff ff       	call   8003b4 <diskaddr>
  8006d1:	83 c4 08             	add    $0x8,%esp
  8006d4:	68 04 3c 80 00       	push   $0x803c04
  8006d9:	50                   	push   %eax
  8006da:	e8 41 1c 00 00       	call   802320 <strcmp>
  8006df:	83 c4 10             	add    $0x10,%esp
  8006e2:	85 c0                	test   %eax,%eax
  8006e4:	0f 85 f2 00 00 00    	jne    8007dc <bc_init+0x2e1>
	memmove(diskaddr(1), &backup, sizeof backup);
  8006ea:	83 ec 0c             	sub    $0xc,%esp
  8006ed:	6a 01                	push   $0x1
  8006ef:	e8 c0 fc ff ff       	call   8003b4 <diskaddr>
  8006f4:	83 c4 0c             	add    $0xc,%esp
  8006f7:	68 08 01 00 00       	push   $0x108
  8006fc:	8d 95 e8 fd ff ff    	lea    -0x218(%ebp),%edx
  800702:	52                   	push   %edx
  800703:	50                   	push   %eax
  800704:	e8 0e 1d 00 00       	call   802417 <memmove>
	flush_block(diskaddr(1));
  800709:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800710:	e8 9f fc ff ff       	call   8003b4 <diskaddr>
  800715:	89 04 24             	mov    %eax,(%esp)
  800718:	e8 21 fd ff ff       	call   80043e <flush_block>
	cprintf("block cache is good\n");
  80071d:	c7 04 24 40 3c 80 00 	movl   $0x803c40,(%esp)
  800724:	e8 5f 15 00 00       	call   801c88 <cprintf>
	check_bc();

	// cache the super block by reading it once
	memmove(&super, diskaddr(1), sizeof super);
  800729:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800730:	e8 7f fc ff ff       	call   8003b4 <diskaddr>
  800735:	83 c4 0c             	add    $0xc,%esp
  800738:	68 08 01 00 00       	push   $0x108
  80073d:	50                   	push   %eax
  80073e:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  800744:	50                   	push   %eax
  800745:	e8 cd 1c 00 00       	call   802417 <memmove>
}
  80074a:	83 c4 10             	add    $0x10,%esp
  80074d:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800750:	c9                   	leave  
  800751:	c3                   	ret    
	assert(va_is_mapped(diskaddr(1)));
  800752:	68 26 3c 80 00       	push   $0x803c26
  800757:	68 9d 3a 80 00       	push   $0x803a9d
  80075c:	6a 73                	push   $0x73
  80075e:	68 90 3b 80 00       	push   $0x803b90
  800763:	e8 39 14 00 00       	call   801ba1 <_panic>
	assert(!va_is_dirty(diskaddr(1)));
  800768:	68 0b 3c 80 00       	push   $0x803c0b
  80076d:	68 9d 3a 80 00       	push   $0x803a9d
  800772:	6a 74                	push   $0x74
  800774:	68 90 3b 80 00       	push   $0x803b90
  800779:	e8 23 14 00 00       	call   801ba1 <_panic>
	assert(!va_is_mapped(diskaddr(1)));
  80077e:	68 25 3c 80 00       	push   $0x803c25
  800783:	68 9d 3a 80 00       	push   $0x803a9d
  800788:	6a 78                	push   $0x78
  80078a:	68 90 3b 80 00       	push   $0x803b90
  80078f:	e8 0d 14 00 00       	call   801ba1 <_panic>
	assert(strcmp(diskaddr(1), "OOPS!\n") == 0);
  800794:	68 6c 3b 80 00       	push   $0x803b6c
  800799:	68 9d 3a 80 00       	push   $0x803a9d
  80079e:	6a 7b                	push   $0x7b
  8007a0:	68 90 3b 80 00       	push   $0x803b90
  8007a5:	e8 f7 13 00 00       	call   801ba1 <_panic>
	assert(va_is_mapped(diskaddr(1)));
  8007aa:	68 26 3c 80 00       	push   $0x803c26
  8007af:	68 9d 3a 80 00       	push   $0x803a9d
  8007b4:	68 8c 00 00 00       	push   $0x8c
  8007b9:	68 90 3b 80 00       	push   $0x803b90
  8007be:	e8 de 13 00 00       	call   801ba1 <_panic>
	assert(!va_is_mapped(diskaddr(1)));
  8007c3:	68 25 3c 80 00       	push   $0x803c25
  8007c8:	68 9d 3a 80 00       	push   $0x803a9d
  8007cd:	68 94 00 00 00       	push   $0x94
  8007d2:	68 90 3b 80 00       	push   $0x803b90
  8007d7:	e8 c5 13 00 00       	call   801ba1 <_panic>
	assert(strcmp(diskaddr(1), "OOPS!\n") == 0);
  8007dc:	68 6c 3b 80 00       	push   $0x803b6c
  8007e1:	68 9d 3a 80 00       	push   $0x803a9d
  8007e6:	68 97 00 00 00       	push   $0x97
  8007eb:	68 90 3b 80 00       	push   $0x803b90
  8007f0:	e8 ac 13 00 00       	call   801ba1 <_panic>

008007f5 <check_super>:
// --------------------------------------------------------------

// Validate the file system super-block.
void
check_super(void)
{
  8007f5:	f3 0f 1e fb          	endbr32 
  8007f9:	55                   	push   %ebp
  8007fa:	89 e5                	mov    %esp,%ebp
  8007fc:	83 ec 08             	sub    $0x8,%esp
	if (super->s_magic != FS_MAGIC)
  8007ff:	a1 08 a0 80 00       	mov    0x80a008,%eax
  800804:	81 38 ae 30 05 4a    	cmpl   $0x4a0530ae,(%eax)
  80080a:	75 1b                	jne    800827 <check_super+0x32>
		panic("bad file system magic number");

	if (super->s_nblocks > DISKSIZE/BLKSIZE)
  80080c:	81 78 04 00 00 0c 00 	cmpl   $0xc0000,0x4(%eax)
  800813:	77 26                	ja     80083b <check_super+0x46>
		panic("file system is too large");

	cprintf("superblock is good\n");
  800815:	83 ec 0c             	sub    $0xc,%esp
  800818:	68 93 3c 80 00       	push   $0x803c93
  80081d:	e8 66 14 00 00       	call   801c88 <cprintf>
}
  800822:	83 c4 10             	add    $0x10,%esp
  800825:	c9                   	leave  
  800826:	c3                   	ret    
		panic("bad file system magic number");
  800827:	83 ec 04             	sub    $0x4,%esp
  80082a:	68 55 3c 80 00       	push   $0x803c55
  80082f:	6a 0f                	push   $0xf
  800831:	68 72 3c 80 00       	push   $0x803c72
  800836:	e8 66 13 00 00       	call   801ba1 <_panic>
		panic("file system is too large");
  80083b:	83 ec 04             	sub    $0x4,%esp
  80083e:	68 7a 3c 80 00       	push   $0x803c7a
  800843:	6a 12                	push   $0x12
  800845:	68 72 3c 80 00       	push   $0x803c72
  80084a:	e8 52 13 00 00       	call   801ba1 <_panic>

0080084f <block_is_free>:

// Check to see if the block bitmap indicates that block 'blockno' is free.
// Return 1 if the block is free, 0 if not.
bool
block_is_free(uint32_t blockno)
{
  80084f:	f3 0f 1e fb          	endbr32 
  800853:	55                   	push   %ebp
  800854:	89 e5                	mov    %esp,%ebp
  800856:	53                   	push   %ebx
  800857:	8b 4d 08             	mov    0x8(%ebp),%ecx
	if (super == 0 || blockno >= super->s_nblocks)
  80085a:	a1 08 a0 80 00       	mov    0x80a008,%eax
  80085f:	85 c0                	test   %eax,%eax
  800861:	74 27                	je     80088a <block_is_free+0x3b>
		return 0;
  800863:	ba 00 00 00 00       	mov    $0x0,%edx
	if (super == 0 || blockno >= super->s_nblocks)
  800868:	39 48 04             	cmp    %ecx,0x4(%eax)
  80086b:	76 18                	jbe    800885 <block_is_free+0x36>
	if (bitmap[blockno / 32] & (1 << (blockno % 32)))
  80086d:	89 cb                	mov    %ecx,%ebx
  80086f:	c1 eb 05             	shr    $0x5,%ebx
  800872:	b8 01 00 00 00       	mov    $0x1,%eax
  800877:	d3 e0                	shl    %cl,%eax
  800879:	8b 15 04 a0 80 00    	mov    0x80a004,%edx
  80087f:	85 04 9a             	test   %eax,(%edx,%ebx,4)
  800882:	0f 95 c2             	setne  %dl
		return 1;
	return 0;
}
  800885:	89 d0                	mov    %edx,%eax
  800887:	5b                   	pop    %ebx
  800888:	5d                   	pop    %ebp
  800889:	c3                   	ret    
		return 0;
  80088a:	ba 00 00 00 00       	mov    $0x0,%edx
  80088f:	eb f4                	jmp    800885 <block_is_free+0x36>

00800891 <free_block>:

// Mark a block free in the bitmap
void
free_block(uint32_t blockno)
{
  800891:	f3 0f 1e fb          	endbr32 
  800895:	55                   	push   %ebp
  800896:	89 e5                	mov    %esp,%ebp
  800898:	53                   	push   %ebx
  800899:	83 ec 04             	sub    $0x4,%esp
  80089c:	8b 4d 08             	mov    0x8(%ebp),%ecx
	// Blockno zero is the null pointer of block numbers.
	if (blockno == 0)
  80089f:	85 c9                	test   %ecx,%ecx
  8008a1:	74 1a                	je     8008bd <free_block+0x2c>
		panic("attempt to free zero block");
	bitmap[blockno/32] |= 1<<(blockno%32);
  8008a3:	89 cb                	mov    %ecx,%ebx
  8008a5:	c1 eb 05             	shr    $0x5,%ebx
  8008a8:	8b 15 04 a0 80 00    	mov    0x80a004,%edx
  8008ae:	b8 01 00 00 00       	mov    $0x1,%eax
  8008b3:	d3 e0                	shl    %cl,%eax
  8008b5:	09 04 9a             	or     %eax,(%edx,%ebx,4)
}
  8008b8:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8008bb:	c9                   	leave  
  8008bc:	c3                   	ret    
		panic("attempt to free zero block");
  8008bd:	83 ec 04             	sub    $0x4,%esp
  8008c0:	68 a7 3c 80 00       	push   $0x803ca7
  8008c5:	6a 2d                	push   $0x2d
  8008c7:	68 72 3c 80 00       	push   $0x803c72
  8008cc:	e8 d0 12 00 00       	call   801ba1 <_panic>

008008d1 <alloc_block>:
// -E_NO_DISK if we are out of blocks.
//
// Hint: use free_block as an example for manipulating the bitmap.
int
alloc_block(void)
{
  8008d1:	f3 0f 1e fb          	endbr32 
  8008d5:	55                   	push   %ebp
  8008d6:	89 e5                	mov    %esp,%ebp
  8008d8:	56                   	push   %esi
  8008d9:	53                   	push   %ebx
	// contains the in-use bits for BLKBITSIZE blocks.  There are
	// super->s_nblocks blocks in the disk altogether.

	// LAB 5: Your code here.
	uint32_t i;
	for(i = 0; i < super->s_nblocks; ++i){	//遍历所有块
  8008da:	a1 08 a0 80 00       	mov    0x80a008,%eax
  8008df:	8b 70 04             	mov    0x4(%eax),%esi
  8008e2:	bb 00 00 00 00       	mov    $0x0,%ebx
  8008e7:	39 de                	cmp    %ebx,%esi
  8008e9:	74 32                	je     80091d <alloc_block+0x4c>
		if(block_is_free(i)){	//找到一个空闲的block位
  8008eb:	83 ec 0c             	sub    $0xc,%esp
  8008ee:	53                   	push   %ebx
  8008ef:	e8 5b ff ff ff       	call   80084f <block_is_free>
  8008f4:	83 c4 10             	add    $0x10,%esp
  8008f7:	84 c0                	test   %al,%al
  8008f9:	75 05                	jne    800900 <alloc_block+0x2f>
	for(i = 0; i < super->s_nblocks; ++i){	//遍历所有块
  8008fb:	83 c3 01             	add    $0x1,%ebx
  8008fe:	eb e7                	jmp    8008e7 <alloc_block+0x16>
            // mark this bit as zero which means in use.
            //分配完这个块，标记为已占用，之后不可再分配，除非调用了free_block
			bitmap[i / 32] &= ~(1 << (i % 32)); //设置这个位为in-use（0）
  800900:	89 de                	mov    %ebx,%esi
  800902:	c1 ee 05             	shr    $0x5,%esi
  800905:	8b 15 04 a0 80 00    	mov    0x80a004,%edx
  80090b:	b8 01 00 00 00       	mov    $0x1,%eax
  800910:	89 d9                	mov    %ebx,%ecx
  800912:	d3 e0                	shl    %cl,%eax
  800914:	f7 d0                	not    %eax
  800916:	21 04 b2             	and    %eax,(%edx,%esi,4)
			return i;	//返回free的block number
  800919:	89 d8                	mov    %ebx,%eax
  80091b:	eb 05                	jmp    800922 <alloc_block+0x51>
		}
	}
	return -E_NO_DISK;
  80091d:	b8 f7 ff ff ff       	mov    $0xfffffff7,%eax
}
  800922:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800925:	5b                   	pop    %ebx
  800926:	5e                   	pop    %esi
  800927:	5d                   	pop    %ebp
  800928:	c3                   	ret    

00800929 <file_block_walk>:
//
// Analogy: This is like pgdir_walk for files.
// Hint: Don't forget to clear any block you allocate.
static int
file_block_walk(struct File *f, uint32_t filebno, uint32_t **ppdiskbno, bool alloc)
{
  800929:	55                   	push   %ebp
  80092a:	89 e5                	mov    %esp,%ebp
  80092c:	57                   	push   %edi
  80092d:	56                   	push   %esi
  80092e:	53                   	push   %ebx
  80092f:	83 ec 0c             	sub    $0xc,%esp
  800932:	89 c6                	mov    %eax,%esi
  800934:	8b 45 08             	mov    0x8(%ebp),%eax
       // LAB 5: Your code here.
       	// first do sanity check
	   	uint32_t blockno;
        if(filebno >= NDIRECT + NINDIRECT)return -E_INVAL;
  800937:	81 fa 09 04 00 00    	cmp    $0x409,%edx
  80093d:	0f 87 87 00 00 00    	ja     8009ca <file_block_walk+0xa1>
  800943:	89 d3                	mov    %edx,%ebx
  800945:	89 cf                	mov    %ecx,%edi
        if(filebno < NDIRECT){
  800947:	83 fa 09             	cmp    $0x9,%edx
  80094a:	76 6e                	jbe    8009ba <file_block_walk+0x91>
            *ppdiskbno = f->f_direct + filebno;
            return 0;
        }
        if(!(f->f_indirect)){
  80094c:	83 be b0 00 00 00 00 	cmpl   $0x0,0xb0(%esi)
  800953:	75 41                	jne    800996 <file_block_walk+0x6d>
            // get here means that we need to allocate an indirect block,
            // but alloc was 0.
            if(!alloc)return -E_NOT_FOUND;
  800955:	84 c0                	test   %al,%al
  800957:	74 78                	je     8009d1 <file_block_walk+0xa8>
            // Now we could allocate an indirect block by using alloc_block.
            if((blockno = alloc_block()) < 0)return -E_NO_DISK;
  800959:	e8 73 ff ff ff       	call   8008d1 <alloc_block>
            //之后在blockno这个块编号对应的块中存储file的块编号们
            f->f_indirect = blockno;
  80095e:	89 86 b0 00 00 00    	mov    %eax,0xb0(%esi)
            // claer the block we allocated above.
            // 通过diskaddr将块编号转换为内存空间的虚拟地址，然后清零
            memset(diskaddr(f->f_indirect), 0, BLKSIZE);
  800964:	83 ec 0c             	sub    $0xc,%esp
  800967:	50                   	push   %eax
  800968:	e8 47 fa ff ff       	call   8003b4 <diskaddr>
  80096d:	83 c4 0c             	add    $0xc,%esp
  800970:	68 00 10 00 00       	push   $0x1000
  800975:	6a 00                	push   $0x0
  800977:	50                   	push   %eax
  800978:	e8 4e 1a 00 00       	call   8023cb <memset>
            flush_block(diskaddr(f->f_indirect));
  80097d:	83 c4 04             	add    $0x4,%esp
  800980:	ff b6 b0 00 00 00    	pushl  0xb0(%esi)
  800986:	e8 29 fa ff ff       	call   8003b4 <diskaddr>
  80098b:	89 04 24             	mov    %eax,(%esp)
  80098e:	e8 ab fa ff ff       	call   80043e <flush_block>
  800993:	83 c4 10             	add    $0x10,%esp
        }
        // There is a trick:f->f_indirect is an block number while f->direct is an virtual address.
        // That's why we need to convert f->f_indirect to virtual address firstly.
        *ppdiskbno = ((uint32_t *)diskaddr(f->f_indirect)) + (filebno - NDIRECT);
  800996:	83 ec 0c             	sub    $0xc,%esp
  800999:	ff b6 b0 00 00 00    	pushl  0xb0(%esi)
  80099f:	e8 10 fa ff ff       	call   8003b4 <diskaddr>
  8009a4:	8d 44 98 d8          	lea    -0x28(%eax,%ebx,4),%eax
  8009a8:	89 07                	mov    %eax,(%edi)
        return 0;
  8009aa:	83 c4 10             	add    $0x10,%esp
  8009ad:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8009b2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8009b5:	5b                   	pop    %ebx
  8009b6:	5e                   	pop    %esi
  8009b7:	5f                   	pop    %edi
  8009b8:	5d                   	pop    %ebp
  8009b9:	c3                   	ret    
            *ppdiskbno = f->f_direct + filebno;
  8009ba:	8d 84 96 88 00 00 00 	lea    0x88(%esi,%edx,4),%eax
  8009c1:	89 01                	mov    %eax,(%ecx)
            return 0;
  8009c3:	b8 00 00 00 00       	mov    $0x0,%eax
  8009c8:	eb e8                	jmp    8009b2 <file_block_walk+0x89>
        if(filebno >= NDIRECT + NINDIRECT)return -E_INVAL;
  8009ca:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8009cf:	eb e1                	jmp    8009b2 <file_block_walk+0x89>
            if(!alloc)return -E_NOT_FOUND;
  8009d1:	b8 f5 ff ff ff       	mov    $0xfffffff5,%eax
  8009d6:	eb da                	jmp    8009b2 <file_block_walk+0x89>

008009d8 <check_bitmap>:
{
  8009d8:	f3 0f 1e fb          	endbr32 
  8009dc:	55                   	push   %ebp
  8009dd:	89 e5                	mov    %esp,%ebp
  8009df:	56                   	push   %esi
  8009e0:	53                   	push   %ebx
	for (i = 0; i * BLKBITSIZE < super->s_nblocks; i++)
  8009e1:	a1 08 a0 80 00       	mov    0x80a008,%eax
  8009e6:	8b 70 04             	mov    0x4(%eax),%esi
  8009e9:	bb 00 00 00 00       	mov    $0x0,%ebx
  8009ee:	89 d8                	mov    %ebx,%eax
  8009f0:	c1 e0 0f             	shl    $0xf,%eax
  8009f3:	39 c6                	cmp    %eax,%esi
  8009f5:	76 2e                	jbe    800a25 <check_bitmap+0x4d>
		assert(!block_is_free(2+i));
  8009f7:	83 ec 0c             	sub    $0xc,%esp
  8009fa:	8d 43 02             	lea    0x2(%ebx),%eax
  8009fd:	50                   	push   %eax
  8009fe:	e8 4c fe ff ff       	call   80084f <block_is_free>
  800a03:	83 c4 10             	add    $0x10,%esp
  800a06:	84 c0                	test   %al,%al
  800a08:	75 05                	jne    800a0f <check_bitmap+0x37>
	for (i = 0; i * BLKBITSIZE < super->s_nblocks; i++)
  800a0a:	83 c3 01             	add    $0x1,%ebx
  800a0d:	eb df                	jmp    8009ee <check_bitmap+0x16>
		assert(!block_is_free(2+i));
  800a0f:	68 c2 3c 80 00       	push   $0x803cc2
  800a14:	68 9d 3a 80 00       	push   $0x803a9d
  800a19:	6a 58                	push   $0x58
  800a1b:	68 72 3c 80 00       	push   $0x803c72
  800a20:	e8 7c 11 00 00       	call   801ba1 <_panic>
	assert(!block_is_free(0));
  800a25:	83 ec 0c             	sub    $0xc,%esp
  800a28:	6a 00                	push   $0x0
  800a2a:	e8 20 fe ff ff       	call   80084f <block_is_free>
  800a2f:	83 c4 10             	add    $0x10,%esp
  800a32:	84 c0                	test   %al,%al
  800a34:	75 28                	jne    800a5e <check_bitmap+0x86>
	assert(!block_is_free(1));
  800a36:	83 ec 0c             	sub    $0xc,%esp
  800a39:	6a 01                	push   $0x1
  800a3b:	e8 0f fe ff ff       	call   80084f <block_is_free>
  800a40:	83 c4 10             	add    $0x10,%esp
  800a43:	84 c0                	test   %al,%al
  800a45:	75 2d                	jne    800a74 <check_bitmap+0x9c>
	cprintf("bitmap is good\n");
  800a47:	83 ec 0c             	sub    $0xc,%esp
  800a4a:	68 fa 3c 80 00       	push   $0x803cfa
  800a4f:	e8 34 12 00 00       	call   801c88 <cprintf>
}
  800a54:	83 c4 10             	add    $0x10,%esp
  800a57:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800a5a:	5b                   	pop    %ebx
  800a5b:	5e                   	pop    %esi
  800a5c:	5d                   	pop    %ebp
  800a5d:	c3                   	ret    
	assert(!block_is_free(0));
  800a5e:	68 d6 3c 80 00       	push   $0x803cd6
  800a63:	68 9d 3a 80 00       	push   $0x803a9d
  800a68:	6a 5b                	push   $0x5b
  800a6a:	68 72 3c 80 00       	push   $0x803c72
  800a6f:	e8 2d 11 00 00       	call   801ba1 <_panic>
	assert(!block_is_free(1));
  800a74:	68 e8 3c 80 00       	push   $0x803ce8
  800a79:	68 9d 3a 80 00       	push   $0x803a9d
  800a7e:	6a 5c                	push   $0x5c
  800a80:	68 72 3c 80 00       	push   $0x803c72
  800a85:	e8 17 11 00 00       	call   801ba1 <_panic>

00800a8a <fs_init>:
{
  800a8a:	f3 0f 1e fb          	endbr32 
  800a8e:	55                   	push   %ebp
  800a8f:	89 e5                	mov    %esp,%ebp
  800a91:	83 ec 08             	sub    $0x8,%esp
	if (ide_probe_disk1())
  800a94:	e8 c6 f5 ff ff       	call   80005f <ide_probe_disk1>
  800a99:	84 c0                	test   %al,%al
  800a9b:	74 41                	je     800ade <fs_init+0x54>
		ide_set_disk(1);
  800a9d:	83 ec 0c             	sub    $0xc,%esp
  800aa0:	6a 01                	push   $0x1
  800aa2:	e8 1e f6 ff ff       	call   8000c5 <ide_set_disk>
  800aa7:	83 c4 10             	add    $0x10,%esp
	bc_init();
  800aaa:	e8 4c fa ff ff       	call   8004fb <bc_init>
	super = diskaddr(1);
  800aaf:	83 ec 0c             	sub    $0xc,%esp
  800ab2:	6a 01                	push   $0x1
  800ab4:	e8 fb f8 ff ff       	call   8003b4 <diskaddr>
  800ab9:	a3 08 a0 80 00       	mov    %eax,0x80a008
	check_super();
  800abe:	e8 32 fd ff ff       	call   8007f5 <check_super>
	bitmap = diskaddr(2);
  800ac3:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  800aca:	e8 e5 f8 ff ff       	call   8003b4 <diskaddr>
  800acf:	a3 04 a0 80 00       	mov    %eax,0x80a004
	check_bitmap();
  800ad4:	e8 ff fe ff ff       	call   8009d8 <check_bitmap>
}
  800ad9:	83 c4 10             	add    $0x10,%esp
  800adc:	c9                   	leave  
  800add:	c3                   	ret    
		ide_set_disk(0);
  800ade:	83 ec 0c             	sub    $0xc,%esp
  800ae1:	6a 00                	push   $0x0
  800ae3:	e8 dd f5 ff ff       	call   8000c5 <ide_set_disk>
  800ae8:	83 c4 10             	add    $0x10,%esp
  800aeb:	eb bd                	jmp    800aaa <fs_init+0x20>

00800aed <file_get_block>:
//	-E_INVAL if filebno is out of range.
//
// Hint: Use file_block_walk and alloc_block.
int
file_get_block(struct File *f, uint32_t filebno, char **blk)
{
  800aed:	f3 0f 1e fb          	endbr32 
  800af1:	55                   	push   %ebp
  800af2:	89 e5                	mov    %esp,%ebp
  800af4:	83 ec 24             	sub    $0x24,%esp
       // LAB 5: Your code here.
  int r;
        uint32_t *ppdiskno;

        // value of r might be 0, -E_INVAL, -E_NO_DISK.
        if((r = file_block_walk(f, filebno, &ppdiskno, 1)) < 0)return r;
  800af7:	6a 01                	push   $0x1
  800af9:	8d 4d f4             	lea    -0xc(%ebp),%ecx
  800afc:	8b 55 0c             	mov    0xc(%ebp),%edx
  800aff:	8b 45 08             	mov    0x8(%ebp),%eax
  800b02:	e8 22 fe ff ff       	call   800929 <file_block_walk>
  800b07:	83 c4 10             	add    $0x10,%esp
  800b0a:	85 c0                	test   %eax,%eax
  800b0c:	78 30                	js     800b3e <file_get_block+0x51>
        // *ppdiskno is zero means that we should allocate a block.
        if(!(*ppdiskno)){	//(*ppdiskno)==0【表示这个文件块为空？还没有分配过块，现在需要申请一个块号，之后访问时来导入】
  800b0e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800b11:	83 38 00             	cmpl   $0x0,(%eax)
  800b14:	75 0e                	jne    800b24 <file_get_block+0x37>
            if((r = alloc_block()) < 0)return -E_NO_DISK;
  800b16:	e8 b6 fd ff ff       	call   8008d1 <alloc_block>
  800b1b:	85 c0                	test   %eax,%eax
  800b1d:	78 21                	js     800b40 <file_get_block+0x53>
            *ppdiskno = r;	//重新赋值【这时候这个文件块已经分配了】
  800b1f:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800b22:	89 02                	mov    %eax,(%edx)
        }
        *blk = (char *)diskaddr(*ppdiskno);	//将块编号转换为块编号对应的虚拟地址。
  800b24:	83 ec 0c             	sub    $0xc,%esp
  800b27:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800b2a:	ff 30                	pushl  (%eax)
  800b2c:	e8 83 f8 ff ff       	call   8003b4 <diskaddr>
  800b31:	8b 55 10             	mov    0x10(%ebp),%edx
  800b34:	89 02                	mov    %eax,(%edx)
        return 0;
  800b36:	83 c4 10             	add    $0x10,%esp
  800b39:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b3e:	c9                   	leave  
  800b3f:	c3                   	ret    
            if((r = alloc_block()) < 0)return -E_NO_DISK;
  800b40:	b8 f7 ff ff ff       	mov    $0xfffffff7,%eax
  800b45:	eb f7                	jmp    800b3e <file_get_block+0x51>

00800b47 <walk_path>:
// If we cannot find the file but find the directory
// it should be in, set *pdir and copy the final path
// element into lastelem.
static int
walk_path(const char *path, struct File **pdir, struct File **pf, char *lastelem)
{
  800b47:	55                   	push   %ebp
  800b48:	89 e5                	mov    %esp,%ebp
  800b4a:	57                   	push   %edi
  800b4b:	56                   	push   %esi
  800b4c:	53                   	push   %ebx
  800b4d:	81 ec bc 00 00 00    	sub    $0xbc,%esp
  800b53:	89 95 40 ff ff ff    	mov    %edx,-0xc0(%ebp)
  800b59:	89 8d 3c ff ff ff    	mov    %ecx,-0xc4(%ebp)
	while (*p == '/')
  800b5f:	80 38 2f             	cmpb   $0x2f,(%eax)
  800b62:	75 05                	jne    800b69 <walk_path+0x22>
		p++;
  800b64:	83 c0 01             	add    $0x1,%eax
  800b67:	eb f6                	jmp    800b5f <walk_path+0x18>
	int r;

	// if (*path != '/')
	//	return -E_BAD_PATH;
	path = skip_slash(path);
	f = &super->s_root;
  800b69:	8b 0d 08 a0 80 00    	mov    0x80a008,%ecx
  800b6f:	83 c1 08             	add    $0x8,%ecx
  800b72:	89 8d 4c ff ff ff    	mov    %ecx,-0xb4(%ebp)
	dir = 0;
	name[0] = 0;
  800b78:	c6 85 68 ff ff ff 00 	movb   $0x0,-0x98(%ebp)

	if (pdir)
  800b7f:	8b 8d 40 ff ff ff    	mov    -0xc0(%ebp),%ecx
  800b85:	85 c9                	test   %ecx,%ecx
  800b87:	74 06                	je     800b8f <walk_path+0x48>
		*pdir = 0;
  800b89:	c7 01 00 00 00 00    	movl   $0x0,(%ecx)
	*pf = 0;
  800b8f:	8b 8d 3c ff ff ff    	mov    -0xc4(%ebp),%ecx
  800b95:	c7 01 00 00 00 00    	movl   $0x0,(%ecx)
	dir = 0;
  800b9b:	ba 00 00 00 00       	mov    $0x0,%edx
	while (*path != '\0') {
  800ba0:	e9 c5 01 00 00       	jmp    800d6a <walk_path+0x223>
		dir = f;
		p = path;
		while (*path != '/' && *path != '\0')
			path++;
  800ba5:	83 c6 01             	add    $0x1,%esi
		while (*path != '/' && *path != '\0')
  800ba8:	0f b6 16             	movzbl (%esi),%edx
  800bab:	80 fa 2f             	cmp    $0x2f,%dl
  800bae:	74 04                	je     800bb4 <walk_path+0x6d>
  800bb0:	84 d2                	test   %dl,%dl
  800bb2:	75 f1                	jne    800ba5 <walk_path+0x5e>
		if (path - p >= MAXNAMELEN)
  800bb4:	89 f3                	mov    %esi,%ebx
  800bb6:	29 c3                	sub    %eax,%ebx
  800bb8:	83 fb 7f             	cmp    $0x7f,%ebx
  800bbb:	0f 8f 71 01 00 00    	jg     800d32 <walk_path+0x1eb>
			return -E_BAD_PATH;
		memmove(name, p, path - p);
  800bc1:	83 ec 04             	sub    $0x4,%esp
  800bc4:	53                   	push   %ebx
  800bc5:	50                   	push   %eax
  800bc6:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
  800bcc:	50                   	push   %eax
  800bcd:	e8 45 18 00 00       	call   802417 <memmove>
		name[path - p] = '\0';
  800bd2:	c6 84 1d 68 ff ff ff 	movb   $0x0,-0x98(%ebp,%ebx,1)
  800bd9:	00 
	while (*p == '/')
  800bda:	83 c4 10             	add    $0x10,%esp
  800bdd:	80 3e 2f             	cmpb   $0x2f,(%esi)
  800be0:	75 05                	jne    800be7 <walk_path+0xa0>
		p++;
  800be2:	83 c6 01             	add    $0x1,%esi
  800be5:	eb f6                	jmp    800bdd <walk_path+0x96>
		path = skip_slash(path);

		if (dir->f_type != FTYPE_DIR)
  800be7:	8b 85 4c ff ff ff    	mov    -0xb4(%ebp),%eax
  800bed:	83 b8 84 00 00 00 01 	cmpl   $0x1,0x84(%eax)
  800bf4:	0f 85 3f 01 00 00    	jne    800d39 <walk_path+0x1f2>
	assert((dir->f_size % BLKSIZE) == 0);
  800bfa:	8b 80 80 00 00 00    	mov    0x80(%eax),%eax
  800c00:	89 c1                	mov    %eax,%ecx
  800c02:	81 e1 ff 0f 00 00    	and    $0xfff,%ecx
  800c08:	89 8d 50 ff ff ff    	mov    %ecx,-0xb0(%ebp)
  800c0e:	0f 85 8e 00 00 00    	jne    800ca2 <walk_path+0x15b>
	nblock = dir->f_size / BLKSIZE;
  800c14:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
  800c1a:	85 c0                	test   %eax,%eax
  800c1c:	0f 48 c2             	cmovs  %edx,%eax
  800c1f:	c1 f8 0c             	sar    $0xc,%eax
  800c22:	89 85 48 ff ff ff    	mov    %eax,-0xb8(%ebp)
			if (strcmp(f[j].f_name, name) == 0) {
  800c28:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
  800c2e:	89 b5 44 ff ff ff    	mov    %esi,-0xbc(%ebp)
	for (i = 0; i < nblock; i++) {
  800c34:	8b 8d 50 ff ff ff    	mov    -0xb0(%ebp),%ecx
  800c3a:	39 8d 48 ff ff ff    	cmp    %ecx,-0xb8(%ebp)
  800c40:	74 79                	je     800cbb <walk_path+0x174>
		if ((r = file_get_block(dir, i, &blk)) < 0)
  800c42:	83 ec 04             	sub    $0x4,%esp
  800c45:	8d 85 64 ff ff ff    	lea    -0x9c(%ebp),%eax
  800c4b:	50                   	push   %eax
  800c4c:	ff b5 50 ff ff ff    	pushl  -0xb0(%ebp)
  800c52:	ff b5 4c ff ff ff    	pushl  -0xb4(%ebp)
  800c58:	e8 90 fe ff ff       	call   800aed <file_get_block>
  800c5d:	83 c4 10             	add    $0x10,%esp
  800c60:	85 c0                	test   %eax,%eax
  800c62:	0f 88 d8 00 00 00    	js     800d40 <walk_path+0x1f9>
  800c68:	8b 9d 64 ff ff ff    	mov    -0x9c(%ebp),%ebx
  800c6e:	8d b3 00 10 00 00    	lea    0x1000(%ebx),%esi
			if (strcmp(f[j].f_name, name) == 0) {
  800c74:	89 9d 54 ff ff ff    	mov    %ebx,-0xac(%ebp)
  800c7a:	83 ec 08             	sub    $0x8,%esp
  800c7d:	57                   	push   %edi
  800c7e:	53                   	push   %ebx
  800c7f:	e8 9c 16 00 00       	call   802320 <strcmp>
  800c84:	83 c4 10             	add    $0x10,%esp
  800c87:	85 c0                	test   %eax,%eax
  800c89:	0f 84 c1 00 00 00    	je     800d50 <walk_path+0x209>
  800c8f:	81 c3 00 01 00 00    	add    $0x100,%ebx
		for (j = 0; j < BLKFILES; j++)
  800c95:	39 f3                	cmp    %esi,%ebx
  800c97:	75 db                	jne    800c74 <walk_path+0x12d>
	for (i = 0; i < nblock; i++) {
  800c99:	83 85 50 ff ff ff 01 	addl   $0x1,-0xb0(%ebp)
  800ca0:	eb 92                	jmp    800c34 <walk_path+0xed>
	assert((dir->f_size % BLKSIZE) == 0);
  800ca2:	68 0a 3d 80 00       	push   $0x803d0a
  800ca7:	68 9d 3a 80 00       	push   $0x803a9d
  800cac:	68 d5 00 00 00       	push   $0xd5
  800cb1:	68 72 3c 80 00       	push   $0x803c72
  800cb6:	e8 e6 0e 00 00       	call   801ba1 <_panic>
  800cbb:	8b b5 44 ff ff ff    	mov    -0xbc(%ebp),%esi
					*pdir = dir;
				if (lastelem)
					strcpy(lastelem, name);
				*pf = 0;
			}
			return r;
  800cc1:	b8 f5 ff ff ff       	mov    $0xfffffff5,%eax
			if (r == -E_NOT_FOUND && *path == '\0') {
  800cc6:	80 3e 00             	cmpb   $0x0,(%esi)
  800cc9:	75 5f                	jne    800d2a <walk_path+0x1e3>
				if (pdir)
  800ccb:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
  800cd1:	85 c0                	test   %eax,%eax
  800cd3:	74 08                	je     800cdd <walk_path+0x196>
					*pdir = dir;
  800cd5:	8b 8d 4c ff ff ff    	mov    -0xb4(%ebp),%ecx
  800cdb:	89 08                	mov    %ecx,(%eax)
				if (lastelem)
  800cdd:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
  800ce1:	74 15                	je     800cf8 <walk_path+0x1b1>
					strcpy(lastelem, name);
  800ce3:	83 ec 08             	sub    $0x8,%esp
  800ce6:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
  800cec:	50                   	push   %eax
  800ced:	ff 75 08             	pushl  0x8(%ebp)
  800cf0:	e8 6c 15 00 00       	call   802261 <strcpy>
  800cf5:	83 c4 10             	add    $0x10,%esp
				*pf = 0;
  800cf8:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
  800cfe:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
			return r;
  800d04:	b8 f5 ff ff ff       	mov    $0xfffffff5,%eax
  800d09:	eb 1f                	jmp    800d2a <walk_path+0x1e3>
		}
	}

	if (pdir)
  800d0b:	8b 85 40 ff ff ff    	mov    -0xc0(%ebp),%eax
  800d11:	85 c0                	test   %eax,%eax
  800d13:	74 02                	je     800d17 <walk_path+0x1d0>
		*pdir = dir;
  800d15:	89 10                	mov    %edx,(%eax)
	*pf = f;
  800d17:	8b 85 3c ff ff ff    	mov    -0xc4(%ebp),%eax
  800d1d:	8b 8d 4c ff ff ff    	mov    -0xb4(%ebp),%ecx
  800d23:	89 08                	mov    %ecx,(%eax)
	return 0;
  800d25:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800d2a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d2d:	5b                   	pop    %ebx
  800d2e:	5e                   	pop    %esi
  800d2f:	5f                   	pop    %edi
  800d30:	5d                   	pop    %ebp
  800d31:	c3                   	ret    
			return -E_BAD_PATH;
  800d32:	b8 f4 ff ff ff       	mov    $0xfffffff4,%eax
  800d37:	eb f1                	jmp    800d2a <walk_path+0x1e3>
			return -E_NOT_FOUND;
  800d39:	b8 f5 ff ff ff       	mov    $0xfffffff5,%eax
  800d3e:	eb ea                	jmp    800d2a <walk_path+0x1e3>
  800d40:	8b b5 44 ff ff ff    	mov    -0xbc(%ebp),%esi
			if (r == -E_NOT_FOUND && *path == '\0') {
  800d46:	83 f8 f5             	cmp    $0xfffffff5,%eax
  800d49:	75 df                	jne    800d2a <walk_path+0x1e3>
  800d4b:	e9 71 ff ff ff       	jmp    800cc1 <walk_path+0x17a>
  800d50:	8b b5 44 ff ff ff    	mov    -0xbc(%ebp),%esi
  800d56:	8b 95 4c ff ff ff    	mov    -0xb4(%ebp),%edx
			if (strcmp(f[j].f_name, name) == 0) {
  800d5c:	8b 85 54 ff ff ff    	mov    -0xac(%ebp),%eax
  800d62:	89 85 4c ff ff ff    	mov    %eax,-0xb4(%ebp)
  800d68:	89 f0                	mov    %esi,%eax
	while (*path != '\0') {
  800d6a:	80 38 00             	cmpb   $0x0,(%eax)
  800d6d:	74 9c                	je     800d0b <walk_path+0x1c4>
  800d6f:	89 c6                	mov    %eax,%esi
  800d71:	e9 32 fe ff ff       	jmp    800ba8 <walk_path+0x61>

00800d76 <file_open>:

// Open "path".  On success set *pf to point at the file and return 0.
// On error return < 0.
int
file_open(const char *path, struct File **pf)
{
  800d76:	f3 0f 1e fb          	endbr32 
  800d7a:	55                   	push   %ebp
  800d7b:	89 e5                	mov    %esp,%ebp
  800d7d:	83 ec 14             	sub    $0x14,%esp
	return walk_path(path, 0, pf, 0);
  800d80:	6a 00                	push   $0x0
  800d82:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d85:	ba 00 00 00 00       	mov    $0x0,%edx
  800d8a:	8b 45 08             	mov    0x8(%ebp),%eax
  800d8d:	e8 b5 fd ff ff       	call   800b47 <walk_path>
}
  800d92:	c9                   	leave  
  800d93:	c3                   	ret    

00800d94 <file_read>:
// Read count bytes from f into buf, starting from seek position
// offset.  This meant to mimic the standard pread function.
// Returns the number of bytes read, < 0 on error.
ssize_t
file_read(struct File *f, void *buf, size_t count, off_t offset)
{
  800d94:	f3 0f 1e fb          	endbr32 
  800d98:	55                   	push   %ebp
  800d99:	89 e5                	mov    %esp,%ebp
  800d9b:	57                   	push   %edi
  800d9c:	56                   	push   %esi
  800d9d:	53                   	push   %ebx
  800d9e:	83 ec 2c             	sub    $0x2c,%esp
  800da1:	8b 7d 0c             	mov    0xc(%ebp),%edi
  800da4:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800da7:	8b 4d 14             	mov    0x14(%ebp),%ecx
	int r, bn;
	off_t pos;
	char *blk;

	if (offset >= f->f_size)
  800daa:	8b 45 08             	mov    0x8(%ebp),%eax
  800dad:	8b 90 80 00 00 00    	mov    0x80(%eax),%edx
		return 0;
  800db3:	b8 00 00 00 00       	mov    $0x0,%eax
	if (offset >= f->f_size)
  800db8:	39 ca                	cmp    %ecx,%edx
  800dba:	7e 7e                	jle    800e3a <file_read+0xa6>

	count = MIN(count, f->f_size - offset);
  800dbc:	29 ca                	sub    %ecx,%edx
  800dbe:	39 da                	cmp    %ebx,%edx
  800dc0:	89 d8                	mov    %ebx,%eax
  800dc2:	0f 46 c2             	cmovbe %edx,%eax
  800dc5:	89 45 d0             	mov    %eax,-0x30(%ebp)

	for (pos = offset; pos < offset + count; ) {
  800dc8:	89 cb                	mov    %ecx,%ebx
  800dca:	01 c1                	add    %eax,%ecx
  800dcc:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
  800dcf:	89 de                	mov    %ebx,%esi
  800dd1:	39 5d d4             	cmp    %ebx,-0x2c(%ebp)
  800dd4:	76 61                	jbe    800e37 <file_read+0xa3>
		if ((r = file_get_block(f, pos / BLKSIZE, &blk)) < 0)
  800dd6:	83 ec 04             	sub    $0x4,%esp
  800dd9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  800ddc:	50                   	push   %eax
  800ddd:	8d 83 ff 0f 00 00    	lea    0xfff(%ebx),%eax
  800de3:	85 db                	test   %ebx,%ebx
  800de5:	0f 49 c3             	cmovns %ebx,%eax
  800de8:	c1 f8 0c             	sar    $0xc,%eax
  800deb:	50                   	push   %eax
  800dec:	ff 75 08             	pushl  0x8(%ebp)
  800def:	e8 f9 fc ff ff       	call   800aed <file_get_block>
  800df4:	83 c4 10             	add    $0x10,%esp
  800df7:	85 c0                	test   %eax,%eax
  800df9:	78 3f                	js     800e3a <file_read+0xa6>
			return r;
		bn = MIN(BLKSIZE - pos % BLKSIZE, offset + count - pos);
  800dfb:	89 da                	mov    %ebx,%edx
  800dfd:	c1 fa 1f             	sar    $0x1f,%edx
  800e00:	c1 ea 14             	shr    $0x14,%edx
  800e03:	8d 04 13             	lea    (%ebx,%edx,1),%eax
  800e06:	25 ff 0f 00 00       	and    $0xfff,%eax
  800e0b:	29 d0                	sub    %edx,%eax
  800e0d:	ba 00 10 00 00       	mov    $0x1000,%edx
  800e12:	29 c2                	sub    %eax,%edx
  800e14:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800e17:	29 f1                	sub    %esi,%ecx
  800e19:	89 ce                	mov    %ecx,%esi
  800e1b:	39 ca                	cmp    %ecx,%edx
  800e1d:	0f 46 f2             	cmovbe %edx,%esi
		memmove(buf, blk + pos % BLKSIZE, bn);
  800e20:	83 ec 04             	sub    $0x4,%esp
  800e23:	56                   	push   %esi
  800e24:	03 45 e4             	add    -0x1c(%ebp),%eax
  800e27:	50                   	push   %eax
  800e28:	57                   	push   %edi
  800e29:	e8 e9 15 00 00       	call   802417 <memmove>
		pos += bn;
  800e2e:	01 f3                	add    %esi,%ebx
		buf += bn;
  800e30:	01 f7                	add    %esi,%edi
  800e32:	83 c4 10             	add    $0x10,%esp
  800e35:	eb 98                	jmp    800dcf <file_read+0x3b>
	}

	return count;
  800e37:	8b 45 d0             	mov    -0x30(%ebp),%eax
}
  800e3a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e3d:	5b                   	pop    %ebx
  800e3e:	5e                   	pop    %esi
  800e3f:	5f                   	pop    %edi
  800e40:	5d                   	pop    %ebp
  800e41:	c3                   	ret    

00800e42 <file_set_size>:
}

// Set the size of file f, truncating or extending as necessary.
int
file_set_size(struct File *f, off_t newsize)
{
  800e42:	f3 0f 1e fb          	endbr32 
  800e46:	55                   	push   %ebp
  800e47:	89 e5                	mov    %esp,%ebp
  800e49:	57                   	push   %edi
  800e4a:	56                   	push   %esi
  800e4b:	53                   	push   %ebx
  800e4c:	83 ec 2c             	sub    $0x2c,%esp
  800e4f:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800e52:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if (f->f_size > newsize)
  800e55:	8b 83 80 00 00 00    	mov    0x80(%ebx),%eax
  800e5b:	39 f8                	cmp    %edi,%eax
  800e5d:	7f 1c                	jg     800e7b <file_set_size+0x39>
		file_truncate_blocks(f, newsize);
	f->f_size = newsize;
  800e5f:	89 bb 80 00 00 00    	mov    %edi,0x80(%ebx)
	flush_block(f);
  800e65:	83 ec 0c             	sub    $0xc,%esp
  800e68:	53                   	push   %ebx
  800e69:	e8 d0 f5 ff ff       	call   80043e <flush_block>
	return 0;
}
  800e6e:	b8 00 00 00 00       	mov    $0x0,%eax
  800e73:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e76:	5b                   	pop    %ebx
  800e77:	5e                   	pop    %esi
  800e78:	5f                   	pop    %edi
  800e79:	5d                   	pop    %ebp
  800e7a:	c3                   	ret    
	old_nblocks = (f->f_size + BLKSIZE - 1) / BLKSIZE;
  800e7b:	8d 90 fe 1f 00 00    	lea    0x1ffe(%eax),%edx
  800e81:	05 ff 0f 00 00       	add    $0xfff,%eax
  800e86:	0f 48 c2             	cmovs  %edx,%eax
  800e89:	c1 f8 0c             	sar    $0xc,%eax
  800e8c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
	new_nblocks = (newsize + BLKSIZE - 1) / BLKSIZE;
  800e8f:	8d 87 fe 1f 00 00    	lea    0x1ffe(%edi),%eax
  800e95:	89 fa                	mov    %edi,%edx
  800e97:	81 c2 ff 0f 00 00    	add    $0xfff,%edx
  800e9d:	0f 49 c2             	cmovns %edx,%eax
  800ea0:	c1 f8 0c             	sar    $0xc,%eax
  800ea3:	89 45 d0             	mov    %eax,-0x30(%ebp)
	for (bno = new_nblocks; bno < old_nblocks; bno++)
  800ea6:	89 c6                	mov    %eax,%esi
  800ea8:	eb 3c                	jmp    800ee6 <file_set_size+0xa4>
	if (new_nblocks <= NDIRECT && f->f_indirect) {
  800eaa:	83 7d d0 0a          	cmpl   $0xa,-0x30(%ebp)
  800eae:	77 af                	ja     800e5f <file_set_size+0x1d>
  800eb0:	8b 83 b0 00 00 00    	mov    0xb0(%ebx),%eax
  800eb6:	85 c0                	test   %eax,%eax
  800eb8:	74 a5                	je     800e5f <file_set_size+0x1d>
		free_block(f->f_indirect);
  800eba:	83 ec 0c             	sub    $0xc,%esp
  800ebd:	50                   	push   %eax
  800ebe:	e8 ce f9 ff ff       	call   800891 <free_block>
		f->f_indirect = 0;
  800ec3:	c7 83 b0 00 00 00 00 	movl   $0x0,0xb0(%ebx)
  800eca:	00 00 00 
  800ecd:	83 c4 10             	add    $0x10,%esp
  800ed0:	eb 8d                	jmp    800e5f <file_set_size+0x1d>
			cprintf("warning: file_free_block: %e", r);
  800ed2:	83 ec 08             	sub    $0x8,%esp
  800ed5:	50                   	push   %eax
  800ed6:	68 27 3d 80 00       	push   $0x803d27
  800edb:	e8 a8 0d 00 00       	call   801c88 <cprintf>
  800ee0:	83 c4 10             	add    $0x10,%esp
	for (bno = new_nblocks; bno < old_nblocks; bno++)
  800ee3:	83 c6 01             	add    $0x1,%esi
  800ee6:	39 75 d4             	cmp    %esi,-0x2c(%ebp)
  800ee9:	76 bf                	jbe    800eaa <file_set_size+0x68>
	if ((r = file_block_walk(f, filebno, &ptr, 0)) < 0)
  800eeb:	83 ec 0c             	sub    $0xc,%esp
  800eee:	6a 00                	push   $0x0
  800ef0:	8d 4d e4             	lea    -0x1c(%ebp),%ecx
  800ef3:	89 f2                	mov    %esi,%edx
  800ef5:	89 d8                	mov    %ebx,%eax
  800ef7:	e8 2d fa ff ff       	call   800929 <file_block_walk>
  800efc:	83 c4 10             	add    $0x10,%esp
  800eff:	85 c0                	test   %eax,%eax
  800f01:	78 cf                	js     800ed2 <file_set_size+0x90>
	if (*ptr) {
  800f03:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800f06:	8b 00                	mov    (%eax),%eax
  800f08:	85 c0                	test   %eax,%eax
  800f0a:	74 d7                	je     800ee3 <file_set_size+0xa1>
		free_block(*ptr);
  800f0c:	83 ec 0c             	sub    $0xc,%esp
  800f0f:	50                   	push   %eax
  800f10:	e8 7c f9 ff ff       	call   800891 <free_block>
		*ptr = 0;
  800f15:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800f18:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
  800f1e:	83 c4 10             	add    $0x10,%esp
  800f21:	eb c0                	jmp    800ee3 <file_set_size+0xa1>

00800f23 <file_write>:
{
  800f23:	f3 0f 1e fb          	endbr32 
  800f27:	55                   	push   %ebp
  800f28:	89 e5                	mov    %esp,%ebp
  800f2a:	57                   	push   %edi
  800f2b:	56                   	push   %esi
  800f2c:	53                   	push   %ebx
  800f2d:	83 ec 2c             	sub    $0x2c,%esp
  800f30:	8b 7d 0c             	mov    0xc(%ebp),%edi
  800f33:	8b 5d 14             	mov    0x14(%ebp),%ebx
	if (offset + count > f->f_size)
  800f36:	89 d8                	mov    %ebx,%eax
  800f38:	03 45 10             	add    0x10(%ebp),%eax
  800f3b:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800f3e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800f41:	3b 81 80 00 00 00    	cmp    0x80(%ecx),%eax
  800f47:	77 68                	ja     800fb1 <file_write+0x8e>
	for (pos = offset; pos < offset + count; ) {
  800f49:	89 de                	mov    %ebx,%esi
  800f4b:	39 5d d4             	cmp    %ebx,-0x2c(%ebp)
  800f4e:	76 74                	jbe    800fc4 <file_write+0xa1>
		if ((r = file_get_block(f, pos / BLKSIZE, &blk)) < 0)
  800f50:	83 ec 04             	sub    $0x4,%esp
  800f53:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  800f56:	50                   	push   %eax
  800f57:	8d 83 ff 0f 00 00    	lea    0xfff(%ebx),%eax
  800f5d:	85 db                	test   %ebx,%ebx
  800f5f:	0f 49 c3             	cmovns %ebx,%eax
  800f62:	c1 f8 0c             	sar    $0xc,%eax
  800f65:	50                   	push   %eax
  800f66:	ff 75 08             	pushl  0x8(%ebp)
  800f69:	e8 7f fb ff ff       	call   800aed <file_get_block>
  800f6e:	83 c4 10             	add    $0x10,%esp
  800f71:	85 c0                	test   %eax,%eax
  800f73:	78 52                	js     800fc7 <file_write+0xa4>
		bn = MIN(BLKSIZE - pos % BLKSIZE, offset + count - pos);
  800f75:	89 da                	mov    %ebx,%edx
  800f77:	c1 fa 1f             	sar    $0x1f,%edx
  800f7a:	c1 ea 14             	shr    $0x14,%edx
  800f7d:	8d 04 13             	lea    (%ebx,%edx,1),%eax
  800f80:	25 ff 0f 00 00       	and    $0xfff,%eax
  800f85:	29 d0                	sub    %edx,%eax
  800f87:	b9 00 10 00 00       	mov    $0x1000,%ecx
  800f8c:	29 c1                	sub    %eax,%ecx
  800f8e:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800f91:	29 f2                	sub    %esi,%edx
  800f93:	39 d1                	cmp    %edx,%ecx
  800f95:	89 d6                	mov    %edx,%esi
  800f97:	0f 46 f1             	cmovbe %ecx,%esi
		memmove(blk + pos % BLKSIZE, buf, bn);
  800f9a:	83 ec 04             	sub    $0x4,%esp
  800f9d:	56                   	push   %esi
  800f9e:	57                   	push   %edi
  800f9f:	03 45 e4             	add    -0x1c(%ebp),%eax
  800fa2:	50                   	push   %eax
  800fa3:	e8 6f 14 00 00       	call   802417 <memmove>
		pos += bn;
  800fa8:	01 f3                	add    %esi,%ebx
		buf += bn;
  800faa:	01 f7                	add    %esi,%edi
  800fac:	83 c4 10             	add    $0x10,%esp
  800faf:	eb 98                	jmp    800f49 <file_write+0x26>
		if ((r = file_set_size(f, offset + count)) < 0)
  800fb1:	83 ec 08             	sub    $0x8,%esp
  800fb4:	50                   	push   %eax
  800fb5:	51                   	push   %ecx
  800fb6:	e8 87 fe ff ff       	call   800e42 <file_set_size>
  800fbb:	83 c4 10             	add    $0x10,%esp
  800fbe:	85 c0                	test   %eax,%eax
  800fc0:	79 87                	jns    800f49 <file_write+0x26>
  800fc2:	eb 03                	jmp    800fc7 <file_write+0xa4>
	return count;
  800fc4:	8b 45 10             	mov    0x10(%ebp),%eax
}
  800fc7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800fca:	5b                   	pop    %ebx
  800fcb:	5e                   	pop    %esi
  800fcc:	5f                   	pop    %edi
  800fcd:	5d                   	pop    %ebp
  800fce:	c3                   	ret    

00800fcf <file_flush>:
// Loop over all the blocks in file.
// Translate the file block number into a disk block number
// and then check whether that disk block is dirty.  If so, write it out.
void
file_flush(struct File *f)
{
  800fcf:	f3 0f 1e fb          	endbr32 
  800fd3:	55                   	push   %ebp
  800fd4:	89 e5                	mov    %esp,%ebp
  800fd6:	56                   	push   %esi
  800fd7:	53                   	push   %ebx
  800fd8:	83 ec 10             	sub    $0x10,%esp
  800fdb:	8b 75 08             	mov    0x8(%ebp),%esi
	int i;
	uint32_t *pdiskbno;

	for (i = 0; i < (f->f_size + BLKSIZE - 1) / BLKSIZE; i++) {
  800fde:	bb 00 00 00 00       	mov    $0x0,%ebx
  800fe3:	eb 03                	jmp    800fe8 <file_flush+0x19>
  800fe5:	83 c3 01             	add    $0x1,%ebx
  800fe8:	8b 96 80 00 00 00    	mov    0x80(%esi),%edx
  800fee:	8d 82 fe 1f 00 00    	lea    0x1ffe(%edx),%eax
  800ff4:	81 c2 ff 0f 00 00    	add    $0xfff,%edx
  800ffa:	0f 49 c2             	cmovns %edx,%eax
  800ffd:	c1 f8 0c             	sar    $0xc,%eax
  801000:	39 d8                	cmp    %ebx,%eax
  801002:	7e 3b                	jle    80103f <file_flush+0x70>
		if (file_block_walk(f, i, &pdiskbno, 0) < 0 ||
  801004:	83 ec 0c             	sub    $0xc,%esp
  801007:	6a 00                	push   $0x0
  801009:	8d 4d f4             	lea    -0xc(%ebp),%ecx
  80100c:	89 da                	mov    %ebx,%edx
  80100e:	89 f0                	mov    %esi,%eax
  801010:	e8 14 f9 ff ff       	call   800929 <file_block_walk>
  801015:	83 c4 10             	add    $0x10,%esp
  801018:	85 c0                	test   %eax,%eax
  80101a:	78 c9                	js     800fe5 <file_flush+0x16>
		    pdiskbno == NULL || *pdiskbno == 0)
  80101c:	8b 45 f4             	mov    -0xc(%ebp),%eax
		if (file_block_walk(f, i, &pdiskbno, 0) < 0 ||
  80101f:	85 c0                	test   %eax,%eax
  801021:	74 c2                	je     800fe5 <file_flush+0x16>
		    pdiskbno == NULL || *pdiskbno == 0)
  801023:	8b 00                	mov    (%eax),%eax
  801025:	85 c0                	test   %eax,%eax
  801027:	74 bc                	je     800fe5 <file_flush+0x16>
			continue;
		flush_block(diskaddr(*pdiskbno));
  801029:	83 ec 0c             	sub    $0xc,%esp
  80102c:	50                   	push   %eax
  80102d:	e8 82 f3 ff ff       	call   8003b4 <diskaddr>
  801032:	89 04 24             	mov    %eax,(%esp)
  801035:	e8 04 f4 ff ff       	call   80043e <flush_block>
  80103a:	83 c4 10             	add    $0x10,%esp
  80103d:	eb a6                	jmp    800fe5 <file_flush+0x16>
	}
	flush_block(f);
  80103f:	83 ec 0c             	sub    $0xc,%esp
  801042:	56                   	push   %esi
  801043:	e8 f6 f3 ff ff       	call   80043e <flush_block>
	if (f->f_indirect)
  801048:	8b 86 b0 00 00 00    	mov    0xb0(%esi),%eax
  80104e:	83 c4 10             	add    $0x10,%esp
  801051:	85 c0                	test   %eax,%eax
  801053:	75 07                	jne    80105c <file_flush+0x8d>
		flush_block(diskaddr(f->f_indirect));
}
  801055:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801058:	5b                   	pop    %ebx
  801059:	5e                   	pop    %esi
  80105a:	5d                   	pop    %ebp
  80105b:	c3                   	ret    
		flush_block(diskaddr(f->f_indirect));
  80105c:	83 ec 0c             	sub    $0xc,%esp
  80105f:	50                   	push   %eax
  801060:	e8 4f f3 ff ff       	call   8003b4 <diskaddr>
  801065:	89 04 24             	mov    %eax,(%esp)
  801068:	e8 d1 f3 ff ff       	call   80043e <flush_block>
  80106d:	83 c4 10             	add    $0x10,%esp
}
  801070:	eb e3                	jmp    801055 <file_flush+0x86>

00801072 <file_create>:
{
  801072:	f3 0f 1e fb          	endbr32 
  801076:	55                   	push   %ebp
  801077:	89 e5                	mov    %esp,%ebp
  801079:	57                   	push   %edi
  80107a:	56                   	push   %esi
  80107b:	53                   	push   %ebx
  80107c:	81 ec b8 00 00 00    	sub    $0xb8,%esp
	if ((r = walk_path(path, &dir, &f, name)) == 0)
  801082:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
  801088:	50                   	push   %eax
  801089:	8d 8d 60 ff ff ff    	lea    -0xa0(%ebp),%ecx
  80108f:	8d 95 64 ff ff ff    	lea    -0x9c(%ebp),%edx
  801095:	8b 45 08             	mov    0x8(%ebp),%eax
  801098:	e8 aa fa ff ff       	call   800b47 <walk_path>
  80109d:	83 c4 10             	add    $0x10,%esp
  8010a0:	85 c0                	test   %eax,%eax
  8010a2:	0f 84 0b 01 00 00    	je     8011b3 <file_create+0x141>
	if (r != -E_NOT_FOUND || dir == 0)
  8010a8:	83 f8 f5             	cmp    $0xfffffff5,%eax
  8010ab:	0f 85 ca 00 00 00    	jne    80117b <file_create+0x109>
  8010b1:	8b b5 64 ff ff ff    	mov    -0x9c(%ebp),%esi
  8010b7:	85 f6                	test   %esi,%esi
  8010b9:	0f 84 bc 00 00 00    	je     80117b <file_create+0x109>
	assert((dir->f_size % BLKSIZE) == 0);
  8010bf:	8b 86 80 00 00 00    	mov    0x80(%esi),%eax
  8010c5:	89 c3                	mov    %eax,%ebx
  8010c7:	81 e3 ff 0f 00 00    	and    $0xfff,%ebx
  8010cd:	75 57                	jne    801126 <file_create+0xb4>
	nblock = dir->f_size / BLKSIZE;
  8010cf:	8d 90 ff 0f 00 00    	lea    0xfff(%eax),%edx
  8010d5:	85 c0                	test   %eax,%eax
  8010d7:	0f 48 c2             	cmovs  %edx,%eax
  8010da:	c1 f8 0c             	sar    $0xc,%eax
  8010dd:	89 85 54 ff ff ff    	mov    %eax,-0xac(%ebp)
		if ((r = file_get_block(dir, i, &blk)) < 0)
  8010e3:	8d bd 5c ff ff ff    	lea    -0xa4(%ebp),%edi
	for (i = 0; i < nblock; i++) {
  8010e9:	39 9d 54 ff ff ff    	cmp    %ebx,-0xac(%ebp)
  8010ef:	0f 84 8e 00 00 00    	je     801183 <file_create+0x111>
		if ((r = file_get_block(dir, i, &blk)) < 0)
  8010f5:	83 ec 04             	sub    $0x4,%esp
  8010f8:	57                   	push   %edi
  8010f9:	53                   	push   %ebx
  8010fa:	56                   	push   %esi
  8010fb:	e8 ed f9 ff ff       	call   800aed <file_get_block>
  801100:	83 c4 10             	add    $0x10,%esp
  801103:	85 c0                	test   %eax,%eax
  801105:	78 74                	js     80117b <file_create+0x109>
  801107:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
  80110d:	8d 90 00 10 00 00    	lea    0x1000(%eax),%edx
			if (f[j].f_name[0] == '\0') {
  801113:	80 38 00             	cmpb   $0x0,(%eax)
  801116:	74 27                	je     80113f <file_create+0xcd>
  801118:	05 00 01 00 00       	add    $0x100,%eax
		for (j = 0; j < BLKFILES; j++)
  80111d:	39 d0                	cmp    %edx,%eax
  80111f:	75 f2                	jne    801113 <file_create+0xa1>
	for (i = 0; i < nblock; i++) {
  801121:	83 c3 01             	add    $0x1,%ebx
  801124:	eb c3                	jmp    8010e9 <file_create+0x77>
	assert((dir->f_size % BLKSIZE) == 0);
  801126:	68 0a 3d 80 00       	push   $0x803d0a
  80112b:	68 9d 3a 80 00       	push   $0x803a9d
  801130:	68 ee 00 00 00       	push   $0xee
  801135:	68 72 3c 80 00       	push   $0x803c72
  80113a:	e8 62 0a 00 00       	call   801ba1 <_panic>
				*file = &f[j];
  80113f:	89 85 60 ff ff ff    	mov    %eax,-0xa0(%ebp)
	strcpy(f->f_name, name);
  801145:	83 ec 08             	sub    $0x8,%esp
  801148:	8d 85 68 ff ff ff    	lea    -0x98(%ebp),%eax
  80114e:	50                   	push   %eax
  80114f:	ff b5 60 ff ff ff    	pushl  -0xa0(%ebp)
  801155:	e8 07 11 00 00       	call   802261 <strcpy>
	*pf = f;
  80115a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80115d:	8b 95 60 ff ff ff    	mov    -0xa0(%ebp),%edx
  801163:	89 10                	mov    %edx,(%eax)
	file_flush(dir);
  801165:	83 c4 04             	add    $0x4,%esp
  801168:	ff b5 64 ff ff ff    	pushl  -0x9c(%ebp)
  80116e:	e8 5c fe ff ff       	call   800fcf <file_flush>
	return 0;
  801173:	83 c4 10             	add    $0x10,%esp
  801176:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80117b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80117e:	5b                   	pop    %ebx
  80117f:	5e                   	pop    %esi
  801180:	5f                   	pop    %edi
  801181:	5d                   	pop    %ebp
  801182:	c3                   	ret    
	dir->f_size += BLKSIZE;
  801183:	81 86 80 00 00 00 00 	addl   $0x1000,0x80(%esi)
  80118a:	10 00 00 
	if ((r = file_get_block(dir, i, &blk)) < 0)
  80118d:	83 ec 04             	sub    $0x4,%esp
  801190:	8d 85 5c ff ff ff    	lea    -0xa4(%ebp),%eax
  801196:	50                   	push   %eax
  801197:	53                   	push   %ebx
  801198:	56                   	push   %esi
  801199:	e8 4f f9 ff ff       	call   800aed <file_get_block>
  80119e:	83 c4 10             	add    $0x10,%esp
  8011a1:	85 c0                	test   %eax,%eax
  8011a3:	78 d6                	js     80117b <file_create+0x109>
	*file = &f[0];
  8011a5:	8b 85 5c ff ff ff    	mov    -0xa4(%ebp),%eax
  8011ab:	89 85 60 ff ff ff    	mov    %eax,-0xa0(%ebp)
	return 0;
  8011b1:	eb 92                	jmp    801145 <file_create+0xd3>
		return -E_FILE_EXISTS;
  8011b3:	b8 f3 ff ff ff       	mov    $0xfffffff3,%eax
  8011b8:	eb c1                	jmp    80117b <file_create+0x109>

008011ba <fs_sync>:


// Sync the entire file system.  A big hammer.
void
fs_sync(void)
{
  8011ba:	f3 0f 1e fb          	endbr32 
  8011be:	55                   	push   %ebp
  8011bf:	89 e5                	mov    %esp,%ebp
  8011c1:	53                   	push   %ebx
  8011c2:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 1; i < super->s_nblocks; i++)
  8011c5:	bb 01 00 00 00       	mov    $0x1,%ebx
  8011ca:	a1 08 a0 80 00       	mov    0x80a008,%eax
  8011cf:	39 58 04             	cmp    %ebx,0x4(%eax)
  8011d2:	76 19                	jbe    8011ed <fs_sync+0x33>
		flush_block(diskaddr(i));
  8011d4:	83 ec 0c             	sub    $0xc,%esp
  8011d7:	53                   	push   %ebx
  8011d8:	e8 d7 f1 ff ff       	call   8003b4 <diskaddr>
  8011dd:	89 04 24             	mov    %eax,(%esp)
  8011e0:	e8 59 f2 ff ff       	call   80043e <flush_block>
	for (i = 1; i < super->s_nblocks; i++)
  8011e5:	83 c3 01             	add    $0x1,%ebx
  8011e8:	83 c4 10             	add    $0x10,%esp
  8011eb:	eb dd                	jmp    8011ca <fs_sync+0x10>
}
  8011ed:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8011f0:	c9                   	leave  
  8011f1:	c3                   	ret    

008011f2 <serve_sync>:
}


int
serve_sync(envid_t envid, union Fsipc *req)
{
  8011f2:	f3 0f 1e fb          	endbr32 
  8011f6:	55                   	push   %ebp
  8011f7:	89 e5                	mov    %esp,%ebp
  8011f9:	83 ec 08             	sub    $0x8,%esp
	fs_sync();
  8011fc:	e8 b9 ff ff ff       	call   8011ba <fs_sync>
	return 0;
}
  801201:	b8 00 00 00 00       	mov    $0x0,%eax
  801206:	c9                   	leave  
  801207:	c3                   	ret    

00801208 <serve_init>:
{
  801208:	f3 0f 1e fb          	endbr32 
  80120c:	ba 60 50 80 00       	mov    $0x805060,%edx
	uintptr_t va = FILEVA;
  801211:	b9 00 00 00 d0       	mov    $0xd0000000,%ecx
	for (i = 0; i < MAXOPEN; i++) {
  801216:	b8 00 00 00 00       	mov    $0x0,%eax
		opentab[i].o_fileid = i;
  80121b:	89 02                	mov    %eax,(%edx)
		opentab[i].o_fd = (struct Fd*) va;
  80121d:	89 4a 0c             	mov    %ecx,0xc(%edx)
		va += PGSIZE;
  801220:	81 c1 00 10 00 00    	add    $0x1000,%ecx
	for (i = 0; i < MAXOPEN; i++) {
  801226:	83 c0 01             	add    $0x1,%eax
  801229:	83 c2 10             	add    $0x10,%edx
  80122c:	3d 00 04 00 00       	cmp    $0x400,%eax
  801231:	75 e8                	jne    80121b <serve_init+0x13>
}
  801233:	c3                   	ret    

00801234 <openfile_alloc>:
{
  801234:	f3 0f 1e fb          	endbr32 
  801238:	55                   	push   %ebp
  801239:	89 e5                	mov    %esp,%ebp
  80123b:	57                   	push   %edi
  80123c:	56                   	push   %esi
  80123d:	53                   	push   %ebx
  80123e:	83 ec 0c             	sub    $0xc,%esp
  801241:	8b 7d 08             	mov    0x8(%ebp),%edi
	for (i = 0; i < MAXOPEN; i++) {
  801244:	bb 00 00 00 00       	mov    $0x0,%ebx
  801249:	89 de                	mov    %ebx,%esi
  80124b:	c1 e6 04             	shl    $0x4,%esi
		switch (pageref(opentab[i].o_fd)) {
  80124e:	83 ec 0c             	sub    $0xc,%esp
  801251:	ff b6 6c 50 80 00    	pushl  0x80506c(%esi)
  801257:	e8 59 20 00 00       	call   8032b5 <pageref>
  80125c:	83 c4 10             	add    $0x10,%esp
  80125f:	85 c0                	test   %eax,%eax
  801261:	74 17                	je     80127a <openfile_alloc+0x46>
  801263:	83 f8 01             	cmp    $0x1,%eax
  801266:	74 30                	je     801298 <openfile_alloc+0x64>
	for (i = 0; i < MAXOPEN; i++) {
  801268:	83 c3 01             	add    $0x1,%ebx
  80126b:	81 fb 00 04 00 00    	cmp    $0x400,%ebx
  801271:	75 d6                	jne    801249 <openfile_alloc+0x15>
	return -E_MAX_OPEN;
  801273:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801278:	eb 4f                	jmp    8012c9 <openfile_alloc+0x95>
			if ((r = sys_page_alloc(0, opentab[i].o_fd, PTE_P|PTE_U|PTE_W)) < 0)
  80127a:	83 ec 04             	sub    $0x4,%esp
  80127d:	6a 07                	push   $0x7
  80127f:	89 d8                	mov    %ebx,%eax
  801281:	c1 e0 04             	shl    $0x4,%eax
  801284:	ff b0 6c 50 80 00    	pushl  0x80506c(%eax)
  80128a:	6a 00                	push   $0x0
  80128c:	e8 12 14 00 00       	call   8026a3 <sys_page_alloc>
  801291:	83 c4 10             	add    $0x10,%esp
  801294:	85 c0                	test   %eax,%eax
  801296:	78 31                	js     8012c9 <openfile_alloc+0x95>
			opentab[i].o_fileid += MAXOPEN;
  801298:	c1 e3 04             	shl    $0x4,%ebx
  80129b:	81 83 60 50 80 00 00 	addl   $0x400,0x805060(%ebx)
  8012a2:	04 00 00 
			*o = &opentab[i];
  8012a5:	81 c6 60 50 80 00    	add    $0x805060,%esi
  8012ab:	89 37                	mov    %esi,(%edi)
			memset(opentab[i].o_fd, 0, PGSIZE);
  8012ad:	83 ec 04             	sub    $0x4,%esp
  8012b0:	68 00 10 00 00       	push   $0x1000
  8012b5:	6a 00                	push   $0x0
  8012b7:	ff b3 6c 50 80 00    	pushl  0x80506c(%ebx)
  8012bd:	e8 09 11 00 00       	call   8023cb <memset>
			return (*o)->o_fileid;
  8012c2:	8b 07                	mov    (%edi),%eax
  8012c4:	8b 00                	mov    (%eax),%eax
  8012c6:	83 c4 10             	add    $0x10,%esp
}
  8012c9:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012cc:	5b                   	pop    %ebx
  8012cd:	5e                   	pop    %esi
  8012ce:	5f                   	pop    %edi
  8012cf:	5d                   	pop    %ebp
  8012d0:	c3                   	ret    

008012d1 <openfile_lookup>:
{
  8012d1:	f3 0f 1e fb          	endbr32 
  8012d5:	55                   	push   %ebp
  8012d6:	89 e5                	mov    %esp,%ebp
  8012d8:	57                   	push   %edi
  8012d9:	56                   	push   %esi
  8012da:	53                   	push   %ebx
  8012db:	83 ec 18             	sub    $0x18,%esp
  8012de:	8b 7d 0c             	mov    0xc(%ebp),%edi
	o = &opentab[fileid % MAXOPEN];
  8012e1:	89 fb                	mov    %edi,%ebx
  8012e3:	81 e3 ff 03 00 00    	and    $0x3ff,%ebx
  8012e9:	89 de                	mov    %ebx,%esi
  8012eb:	c1 e6 04             	shl    $0x4,%esi
	if (pageref(o->o_fd) <= 1 || o->o_fileid != fileid)
  8012ee:	ff b6 6c 50 80 00    	pushl  0x80506c(%esi)
	o = &opentab[fileid % MAXOPEN];
  8012f4:	81 c6 60 50 80 00    	add    $0x805060,%esi
	if (pageref(o->o_fd) <= 1 || o->o_fileid != fileid)
  8012fa:	e8 b6 1f 00 00       	call   8032b5 <pageref>
  8012ff:	83 c4 10             	add    $0x10,%esp
  801302:	83 f8 01             	cmp    $0x1,%eax
  801305:	7e 1d                	jle    801324 <openfile_lookup+0x53>
  801307:	c1 e3 04             	shl    $0x4,%ebx
  80130a:	39 bb 60 50 80 00    	cmp    %edi,0x805060(%ebx)
  801310:	75 19                	jne    80132b <openfile_lookup+0x5a>
	*po = o;
  801312:	8b 45 10             	mov    0x10(%ebp),%eax
  801315:	89 30                	mov    %esi,(%eax)
	return 0;
  801317:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80131c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80131f:	5b                   	pop    %ebx
  801320:	5e                   	pop    %esi
  801321:	5f                   	pop    %edi
  801322:	5d                   	pop    %ebp
  801323:	c3                   	ret    
		return -E_INVAL;
  801324:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801329:	eb f1                	jmp    80131c <openfile_lookup+0x4b>
  80132b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801330:	eb ea                	jmp    80131c <openfile_lookup+0x4b>

00801332 <serve_set_size>:
{
  801332:	f3 0f 1e fb          	endbr32 
  801336:	55                   	push   %ebp
  801337:	89 e5                	mov    %esp,%ebp
  801339:	53                   	push   %ebx
  80133a:	83 ec 18             	sub    $0x18,%esp
  80133d:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	if ((r = openfile_lookup(envid, req->req_fileid, &o)) < 0)
  801340:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801343:	50                   	push   %eax
  801344:	ff 33                	pushl  (%ebx)
  801346:	ff 75 08             	pushl  0x8(%ebp)
  801349:	e8 83 ff ff ff       	call   8012d1 <openfile_lookup>
  80134e:	83 c4 10             	add    $0x10,%esp
  801351:	85 c0                	test   %eax,%eax
  801353:	78 14                	js     801369 <serve_set_size+0x37>
	return file_set_size(o->o_file, req->req_size);
  801355:	83 ec 08             	sub    $0x8,%esp
  801358:	ff 73 04             	pushl  0x4(%ebx)
  80135b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80135e:	ff 70 04             	pushl  0x4(%eax)
  801361:	e8 dc fa ff ff       	call   800e42 <file_set_size>
  801366:	83 c4 10             	add    $0x10,%esp
}
  801369:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80136c:	c9                   	leave  
  80136d:	c3                   	ret    

0080136e <serve_read>:
{
  80136e:	f3 0f 1e fb          	endbr32 
  801372:	55                   	push   %ebp
  801373:	89 e5                	mov    %esp,%ebp
  801375:	53                   	push   %ebx
  801376:	83 ec 18             	sub    $0x18,%esp
  801379:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	if ((r = openfile_lookup(envid, req->req_fileid, &o)) < 0)
  80137c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80137f:	50                   	push   %eax
  801380:	ff 33                	pushl  (%ebx)
  801382:	ff 75 08             	pushl  0x8(%ebp)
  801385:	e8 47 ff ff ff       	call   8012d1 <openfile_lookup>
  80138a:	83 c4 10             	add    $0x10,%esp
  80138d:	85 c0                	test   %eax,%eax
  80138f:	78 25                	js     8013b6 <serve_read+0x48>
	if ((r = file_read(o->o_file, ret->ret_buf, req->req_n, o->o_fd->fd_offset)) < 0)
  801391:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801394:	8b 50 0c             	mov    0xc(%eax),%edx
  801397:	ff 72 04             	pushl  0x4(%edx)
  80139a:	ff 73 04             	pushl  0x4(%ebx)
  80139d:	53                   	push   %ebx
  80139e:	ff 70 04             	pushl  0x4(%eax)
  8013a1:	e8 ee f9 ff ff       	call   800d94 <file_read>
  8013a6:	83 c4 10             	add    $0x10,%esp
  8013a9:	85 c0                	test   %eax,%eax
  8013ab:	78 09                	js     8013b6 <serve_read+0x48>
	o->o_fd->fd_offset += r;
  8013ad:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8013b0:	8b 52 0c             	mov    0xc(%edx),%edx
  8013b3:	01 42 04             	add    %eax,0x4(%edx)
}
  8013b6:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8013b9:	c9                   	leave  
  8013ba:	c3                   	ret    

008013bb <serve_write>:
{
  8013bb:	f3 0f 1e fb          	endbr32 
  8013bf:	55                   	push   %ebp
  8013c0:	89 e5                	mov    %esp,%ebp
  8013c2:	56                   	push   %esi
  8013c3:	53                   	push   %ebx
  8013c4:	83 ec 14             	sub    $0x14,%esp
  8013c7:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int req_n = req->req_n > PGSIZE ? PGSIZE : req->req_n;
  8013ca:	8b 73 04             	mov    0x4(%ebx),%esi
	if ((r = openfile_lookup(envid, req->req_fileid, &o)) < 0)
  8013cd:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8013d0:	50                   	push   %eax
  8013d1:	ff 33                	pushl  (%ebx)
  8013d3:	ff 75 08             	pushl  0x8(%ebp)
  8013d6:	e8 f6 fe ff ff       	call   8012d1 <openfile_lookup>
  8013db:	83 c4 10             	add    $0x10,%esp
  8013de:	85 c0                	test   %eax,%eax
  8013e0:	78 34                	js     801416 <serve_write+0x5b>
	if ((r = file_write(o->o_file, req->req_buf, req_n, o->o_fd->fd_offset)) < 0)
  8013e2:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8013e5:	8b 50 0c             	mov    0xc(%eax),%edx
  8013e8:	ff 72 04             	pushl  0x4(%edx)
	int req_n = req->req_n > PGSIZE ? PGSIZE : req->req_n;
  8013eb:	81 fe 00 10 00 00    	cmp    $0x1000,%esi
  8013f1:	ba 00 10 00 00       	mov    $0x1000,%edx
  8013f6:	0f 47 f2             	cmova  %edx,%esi
	if ((r = file_write(o->o_file, req->req_buf, req_n, o->o_fd->fd_offset)) < 0)
  8013f9:	56                   	push   %esi
  8013fa:	83 c3 08             	add    $0x8,%ebx
  8013fd:	53                   	push   %ebx
  8013fe:	ff 70 04             	pushl  0x4(%eax)
  801401:	e8 1d fb ff ff       	call   800f23 <file_write>
  801406:	83 c4 10             	add    $0x10,%esp
  801409:	85 c0                	test   %eax,%eax
  80140b:	78 09                	js     801416 <serve_write+0x5b>
	o->o_fd->fd_offset += r;
  80140d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801410:	8b 52 0c             	mov    0xc(%edx),%edx
  801413:	01 42 04             	add    %eax,0x4(%edx)
}
  801416:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801419:	5b                   	pop    %ebx
  80141a:	5e                   	pop    %esi
  80141b:	5d                   	pop    %ebp
  80141c:	c3                   	ret    

0080141d <serve_stat>:
{
  80141d:	f3 0f 1e fb          	endbr32 
  801421:	55                   	push   %ebp
  801422:	89 e5                	mov    %esp,%ebp
  801424:	53                   	push   %ebx
  801425:	83 ec 18             	sub    $0x18,%esp
  801428:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	if ((r = openfile_lookup(envid, req->req_fileid, &o)) < 0)
  80142b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80142e:	50                   	push   %eax
  80142f:	ff 33                	pushl  (%ebx)
  801431:	ff 75 08             	pushl  0x8(%ebp)
  801434:	e8 98 fe ff ff       	call   8012d1 <openfile_lookup>
  801439:	83 c4 10             	add    $0x10,%esp
  80143c:	85 c0                	test   %eax,%eax
  80143e:	78 3f                	js     80147f <serve_stat+0x62>
	strcpy(ret->ret_name, o->o_file->f_name);
  801440:	83 ec 08             	sub    $0x8,%esp
  801443:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801446:	ff 70 04             	pushl  0x4(%eax)
  801449:	53                   	push   %ebx
  80144a:	e8 12 0e 00 00       	call   802261 <strcpy>
	ret->ret_size = o->o_file->f_size;
  80144f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801452:	8b 50 04             	mov    0x4(%eax),%edx
  801455:	8b 92 80 00 00 00    	mov    0x80(%edx),%edx
  80145b:	89 93 80 00 00 00    	mov    %edx,0x80(%ebx)
	ret->ret_isdir = (o->o_file->f_type == FTYPE_DIR);
  801461:	8b 40 04             	mov    0x4(%eax),%eax
  801464:	83 c4 10             	add    $0x10,%esp
  801467:	83 b8 84 00 00 00 01 	cmpl   $0x1,0x84(%eax)
  80146e:	0f 94 c0             	sete   %al
  801471:	0f b6 c0             	movzbl %al,%eax
  801474:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80147a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80147f:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801482:	c9                   	leave  
  801483:	c3                   	ret    

00801484 <serve_flush>:
{
  801484:	f3 0f 1e fb          	endbr32 
  801488:	55                   	push   %ebp
  801489:	89 e5                	mov    %esp,%ebp
  80148b:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = openfile_lookup(envid, req->req_fileid, &o)) < 0)
  80148e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801491:	50                   	push   %eax
  801492:	8b 45 0c             	mov    0xc(%ebp),%eax
  801495:	ff 30                	pushl  (%eax)
  801497:	ff 75 08             	pushl  0x8(%ebp)
  80149a:	e8 32 fe ff ff       	call   8012d1 <openfile_lookup>
  80149f:	83 c4 10             	add    $0x10,%esp
  8014a2:	85 c0                	test   %eax,%eax
  8014a4:	78 16                	js     8014bc <serve_flush+0x38>
	file_flush(o->o_file);
  8014a6:	83 ec 0c             	sub    $0xc,%esp
  8014a9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8014ac:	ff 70 04             	pushl  0x4(%eax)
  8014af:	e8 1b fb ff ff       	call   800fcf <file_flush>
	return 0;
  8014b4:	83 c4 10             	add    $0x10,%esp
  8014b7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8014bc:	c9                   	leave  
  8014bd:	c3                   	ret    

008014be <serve_open>:
{
  8014be:	f3 0f 1e fb          	endbr32 
  8014c2:	55                   	push   %ebp
  8014c3:	89 e5                	mov    %esp,%ebp
  8014c5:	53                   	push   %ebx
  8014c6:	81 ec 18 04 00 00    	sub    $0x418,%esp
  8014cc:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	memmove(path, req->req_path, MAXPATHLEN);
  8014cf:	68 00 04 00 00       	push   $0x400
  8014d4:	53                   	push   %ebx
  8014d5:	8d 85 f8 fb ff ff    	lea    -0x408(%ebp),%eax
  8014db:	50                   	push   %eax
  8014dc:	e8 36 0f 00 00       	call   802417 <memmove>
	path[MAXPATHLEN-1] = 0;
  8014e1:	c6 45 f7 00          	movb   $0x0,-0x9(%ebp)
	if ((r = openfile_alloc(&o)) < 0) {
  8014e5:	8d 85 f0 fb ff ff    	lea    -0x410(%ebp),%eax
  8014eb:	89 04 24             	mov    %eax,(%esp)
  8014ee:	e8 41 fd ff ff       	call   801234 <openfile_alloc>
  8014f3:	83 c4 10             	add    $0x10,%esp
  8014f6:	85 c0                	test   %eax,%eax
  8014f8:	0f 88 f0 00 00 00    	js     8015ee <serve_open+0x130>
	if (req->req_omode & O_CREAT) {
  8014fe:	f6 83 01 04 00 00 01 	testb  $0x1,0x401(%ebx)
  801505:	74 33                	je     80153a <serve_open+0x7c>
		if ((r = file_create(path, &f)) < 0) {
  801507:	83 ec 08             	sub    $0x8,%esp
  80150a:	8d 85 f4 fb ff ff    	lea    -0x40c(%ebp),%eax
  801510:	50                   	push   %eax
  801511:	8d 85 f8 fb ff ff    	lea    -0x408(%ebp),%eax
  801517:	50                   	push   %eax
  801518:	e8 55 fb ff ff       	call   801072 <file_create>
  80151d:	83 c4 10             	add    $0x10,%esp
  801520:	85 c0                	test   %eax,%eax
  801522:	79 37                	jns    80155b <serve_open+0x9d>
			if (!(req->req_omode & O_EXCL) && r == -E_FILE_EXISTS)
  801524:	f6 83 01 04 00 00 04 	testb  $0x4,0x401(%ebx)
  80152b:	0f 85 bd 00 00 00    	jne    8015ee <serve_open+0x130>
  801531:	83 f8 f3             	cmp    $0xfffffff3,%eax
  801534:	0f 85 b4 00 00 00    	jne    8015ee <serve_open+0x130>
		if ((r = file_open(path, &f)) < 0) {
  80153a:	83 ec 08             	sub    $0x8,%esp
  80153d:	8d 85 f4 fb ff ff    	lea    -0x40c(%ebp),%eax
  801543:	50                   	push   %eax
  801544:	8d 85 f8 fb ff ff    	lea    -0x408(%ebp),%eax
  80154a:	50                   	push   %eax
  80154b:	e8 26 f8 ff ff       	call   800d76 <file_open>
  801550:	83 c4 10             	add    $0x10,%esp
  801553:	85 c0                	test   %eax,%eax
  801555:	0f 88 93 00 00 00    	js     8015ee <serve_open+0x130>
	if (req->req_omode & O_TRUNC) {
  80155b:	f6 83 01 04 00 00 02 	testb  $0x2,0x401(%ebx)
  801562:	74 17                	je     80157b <serve_open+0xbd>
		if ((r = file_set_size(f, 0)) < 0) {
  801564:	83 ec 08             	sub    $0x8,%esp
  801567:	6a 00                	push   $0x0
  801569:	ff b5 f4 fb ff ff    	pushl  -0x40c(%ebp)
  80156f:	e8 ce f8 ff ff       	call   800e42 <file_set_size>
  801574:	83 c4 10             	add    $0x10,%esp
  801577:	85 c0                	test   %eax,%eax
  801579:	78 73                	js     8015ee <serve_open+0x130>
	if ((r = file_open(path, &f)) < 0) {
  80157b:	83 ec 08             	sub    $0x8,%esp
  80157e:	8d 85 f4 fb ff ff    	lea    -0x40c(%ebp),%eax
  801584:	50                   	push   %eax
  801585:	8d 85 f8 fb ff ff    	lea    -0x408(%ebp),%eax
  80158b:	50                   	push   %eax
  80158c:	e8 e5 f7 ff ff       	call   800d76 <file_open>
  801591:	83 c4 10             	add    $0x10,%esp
  801594:	85 c0                	test   %eax,%eax
  801596:	78 56                	js     8015ee <serve_open+0x130>
	o->o_file = f;
  801598:	8b 85 f0 fb ff ff    	mov    -0x410(%ebp),%eax
  80159e:	8b 95 f4 fb ff ff    	mov    -0x40c(%ebp),%edx
  8015a4:	89 50 04             	mov    %edx,0x4(%eax)
	o->o_fd->fd_file.id = o->o_fileid;
  8015a7:	8b 50 0c             	mov    0xc(%eax),%edx
  8015aa:	8b 08                	mov    (%eax),%ecx
  8015ac:	89 4a 0c             	mov    %ecx,0xc(%edx)
	o->o_fd->fd_omode = req->req_omode & O_ACCMODE;
  8015af:	8b 48 0c             	mov    0xc(%eax),%ecx
  8015b2:	8b 93 00 04 00 00    	mov    0x400(%ebx),%edx
  8015b8:	83 e2 03             	and    $0x3,%edx
  8015bb:	89 51 08             	mov    %edx,0x8(%ecx)
	o->o_fd->fd_dev_id = devfile.dev_id;
  8015be:	8b 40 0c             	mov    0xc(%eax),%eax
  8015c1:	8b 15 64 90 80 00    	mov    0x809064,%edx
  8015c7:	89 10                	mov    %edx,(%eax)
	o->o_mode = req->req_omode;
  8015c9:	8b 85 f0 fb ff ff    	mov    -0x410(%ebp),%eax
  8015cf:	8b 93 00 04 00 00    	mov    0x400(%ebx),%edx
  8015d5:	89 50 08             	mov    %edx,0x8(%eax)
	*pg_store = o->o_fd;
  8015d8:	8b 50 0c             	mov    0xc(%eax),%edx
  8015db:	8b 45 10             	mov    0x10(%ebp),%eax
  8015de:	89 10                	mov    %edx,(%eax)
	*perm_store = PTE_P|PTE_U|PTE_W|PTE_SHARE;
  8015e0:	8b 45 14             	mov    0x14(%ebp),%eax
  8015e3:	c7 00 07 04 00 00    	movl   $0x407,(%eax)
	return 0;
  8015e9:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015ee:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8015f1:	c9                   	leave  
  8015f2:	c3                   	ret    

008015f3 <serve>:
	[FSREQ_SYNC] =		serve_sync
};

void
serve(void)
{
  8015f3:	f3 0f 1e fb          	endbr32 
  8015f7:	55                   	push   %ebp
  8015f8:	89 e5                	mov    %esp,%ebp
  8015fa:	56                   	push   %esi
  8015fb:	53                   	push   %ebx
  8015fc:	83 ec 10             	sub    $0x10,%esp
	int perm, r;
	void *pg;

	while (1) {
		perm = 0;
		req = ipc_recv((int32_t *) &whom, fsreq, &perm);
  8015ff:	8d 5d f0             	lea    -0x10(%ebp),%ebx
  801602:	8d 75 f4             	lea    -0xc(%ebp),%esi
  801605:	e9 82 00 00 00       	jmp    80168c <serve+0x99>
			cprintf("Invalid request from %08x: no argument page\n",
				whom);
			continue; // just leave it hanging...
		}

		pg = NULL;
  80160a:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
		if (req == FSREQ_OPEN) {
  801611:	83 f8 01             	cmp    $0x1,%eax
  801614:	74 23                	je     801639 <serve+0x46>
			r = serve_open(whom, (struct Fsreq_open*)fsreq, &pg, &perm);
		} else if (req < ARRAY_SIZE(handlers) && handlers[req]) {
  801616:	83 f8 08             	cmp    $0x8,%eax
  801619:	77 36                	ja     801651 <serve+0x5e>
  80161b:	8b 14 85 20 50 80 00 	mov    0x805020(,%eax,4),%edx
  801622:	85 d2                	test   %edx,%edx
  801624:	74 2b                	je     801651 <serve+0x5e>
			r = handlers[req](whom, fsreq);
  801626:	83 ec 08             	sub    $0x8,%esp
  801629:	ff 35 44 50 80 00    	pushl  0x805044
  80162f:	ff 75 f4             	pushl  -0xc(%ebp)
  801632:	ff d2                	call   *%edx
  801634:	83 c4 10             	add    $0x10,%esp
  801637:	eb 31                	jmp    80166a <serve+0x77>
			r = serve_open(whom, (struct Fsreq_open*)fsreq, &pg, &perm);
  801639:	53                   	push   %ebx
  80163a:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80163d:	50                   	push   %eax
  80163e:	ff 35 44 50 80 00    	pushl  0x805044
  801644:	ff 75 f4             	pushl  -0xc(%ebp)
  801647:	e8 72 fe ff ff       	call   8014be <serve_open>
  80164c:	83 c4 10             	add    $0x10,%esp
  80164f:	eb 19                	jmp    80166a <serve+0x77>
		} else {
			cprintf("Invalid request code %d from %08x\n", req, whom);
  801651:	83 ec 04             	sub    $0x4,%esp
  801654:	ff 75 f4             	pushl  -0xc(%ebp)
  801657:	50                   	push   %eax
  801658:	68 74 3d 80 00       	push   $0x803d74
  80165d:	e8 26 06 00 00       	call   801c88 <cprintf>
  801662:	83 c4 10             	add    $0x10,%esp
			r = -E_INVAL;
  801665:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
		}
		ipc_send(whom, r, pg, perm);
  80166a:	ff 75 f0             	pushl  -0x10(%ebp)
  80166d:	ff 75 ec             	pushl  -0x14(%ebp)
  801670:	50                   	push   %eax
  801671:	ff 75 f4             	pushl  -0xc(%ebp)
  801674:	e8 5d 13 00 00       	call   8029d6 <ipc_send>
		sys_page_unmap(0, fsreq);
  801679:	83 c4 08             	add    $0x8,%esp
  80167c:	ff 35 44 50 80 00    	pushl  0x805044
  801682:	6a 00                	push   $0x0
  801684:	e8 a7 10 00 00       	call   802730 <sys_page_unmap>
  801689:	83 c4 10             	add    $0x10,%esp
		perm = 0;
  80168c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
		req = ipc_recv((int32_t *) &whom, fsreq, &perm);
  801693:	83 ec 04             	sub    $0x4,%esp
  801696:	53                   	push   %ebx
  801697:	ff 35 44 50 80 00    	pushl  0x805044
  80169d:	56                   	push   %esi
  80169e:	e8 b2 12 00 00       	call   802955 <ipc_recv>
		if (!(perm & PTE_P)) {
  8016a3:	83 c4 10             	add    $0x10,%esp
  8016a6:	f6 45 f0 01          	testb  $0x1,-0x10(%ebp)
  8016aa:	0f 85 5a ff ff ff    	jne    80160a <serve+0x17>
			cprintf("Invalid request from %08x: no argument page\n",
  8016b0:	83 ec 08             	sub    $0x8,%esp
  8016b3:	ff 75 f4             	pushl  -0xc(%ebp)
  8016b6:	68 44 3d 80 00       	push   $0x803d44
  8016bb:	e8 c8 05 00 00       	call   801c88 <cprintf>
			continue; // just leave it hanging...
  8016c0:	83 c4 10             	add    $0x10,%esp
  8016c3:	eb c7                	jmp    80168c <serve+0x99>

008016c5 <umain>:
	}
}

void
umain(int argc, char **argv)
{
  8016c5:	f3 0f 1e fb          	endbr32 
  8016c9:	55                   	push   %ebp
  8016ca:	89 e5                	mov    %esp,%ebp
  8016cc:	83 ec 14             	sub    $0x14,%esp
	static_assert(sizeof(struct File) == 256);
	binaryname = "fs";
  8016cf:	c7 05 60 90 80 00 97 	movl   $0x803d97,0x809060
  8016d6:	3d 80 00 
	cprintf("FS is running\n");
  8016d9:	68 9a 3d 80 00       	push   $0x803d9a
  8016de:	e8 a5 05 00 00       	call   801c88 <cprintf>
	asm volatile("outw %0,%w1" : : "a" (data), "d" (port));
  8016e3:	b8 00 8a ff ff       	mov    $0xffff8a00,%eax
  8016e8:	ba 00 8a 00 00       	mov    $0x8a00,%edx
  8016ed:	66 ef                	out    %ax,(%dx)

	// Check that we are able to do I/O
	outw(0x8A00, 0x8A00);
	cprintf("FS can do I/O\n");
  8016ef:	c7 04 24 a9 3d 80 00 	movl   $0x803da9,(%esp)
  8016f6:	e8 8d 05 00 00       	call   801c88 <cprintf>

	serve_init();
  8016fb:	e8 08 fb ff ff       	call   801208 <serve_init>
	fs_init();
  801700:	e8 85 f3 ff ff       	call   800a8a <fs_init>
        fs_test();
  801705:	e8 05 00 00 00       	call   80170f <fs_test>
	serve();
  80170a:	e8 e4 fe ff ff       	call   8015f3 <serve>

0080170f <fs_test>:

static char *msg = "This is the NEW message of the day!\n\n";

void
fs_test(void)
{
  80170f:	f3 0f 1e fb          	endbr32 
  801713:	55                   	push   %ebp
  801714:	89 e5                	mov    %esp,%ebp
  801716:	53                   	push   %ebx
  801717:	83 ec 18             	sub    $0x18,%esp
	int r;
	char *blk;
	uint32_t *bits;

	// back up bitmap
	if ((r = sys_page_alloc(0, (void*) PGSIZE, PTE_P|PTE_U|PTE_W)) < 0)
  80171a:	6a 07                	push   $0x7
  80171c:	68 00 10 00 00       	push   $0x1000
  801721:	6a 00                	push   $0x0
  801723:	e8 7b 0f 00 00       	call   8026a3 <sys_page_alloc>
  801728:	83 c4 10             	add    $0x10,%esp
  80172b:	85 c0                	test   %eax,%eax
  80172d:	0f 88 68 02 00 00    	js     80199b <fs_test+0x28c>
		panic("sys_page_alloc: %e", r);
	bits = (uint32_t*) PGSIZE;
	memmove(bits, bitmap, PGSIZE);
  801733:	83 ec 04             	sub    $0x4,%esp
  801736:	68 00 10 00 00       	push   $0x1000
  80173b:	ff 35 04 a0 80 00    	pushl  0x80a004
  801741:	68 00 10 00 00       	push   $0x1000
  801746:	e8 cc 0c 00 00       	call   802417 <memmove>
	// allocate block
	if ((r = alloc_block()) < 0)
  80174b:	e8 81 f1 ff ff       	call   8008d1 <alloc_block>
  801750:	83 c4 10             	add    $0x10,%esp
  801753:	85 c0                	test   %eax,%eax
  801755:	0f 88 52 02 00 00    	js     8019ad <fs_test+0x29e>
		panic("alloc_block: %e", r);
	// check that block was free
	assert(bits[r/32] & (1 << (r%32)));
  80175b:	8d 50 1f             	lea    0x1f(%eax),%edx
  80175e:	0f 49 d0             	cmovns %eax,%edx
  801761:	c1 fa 05             	sar    $0x5,%edx
  801764:	89 c3                	mov    %eax,%ebx
  801766:	c1 fb 1f             	sar    $0x1f,%ebx
  801769:	c1 eb 1b             	shr    $0x1b,%ebx
  80176c:	8d 0c 18             	lea    (%eax,%ebx,1),%ecx
  80176f:	83 e1 1f             	and    $0x1f,%ecx
  801772:	29 d9                	sub    %ebx,%ecx
  801774:	b8 01 00 00 00       	mov    $0x1,%eax
  801779:	d3 e0                	shl    %cl,%eax
  80177b:	85 04 95 00 10 00 00 	test   %eax,0x1000(,%edx,4)
  801782:	0f 84 37 02 00 00    	je     8019bf <fs_test+0x2b0>
	// and is not free any more
	assert(!(bitmap[r/32] & (1 << (r%32))));
  801788:	8b 0d 04 a0 80 00    	mov    0x80a004,%ecx
  80178e:	85 04 91             	test   %eax,(%ecx,%edx,4)
  801791:	0f 85 3e 02 00 00    	jne    8019d5 <fs_test+0x2c6>
	cprintf("alloc_block is good\n");
  801797:	83 ec 0c             	sub    $0xc,%esp
  80179a:	68 00 3e 80 00       	push   $0x803e00
  80179f:	e8 e4 04 00 00       	call   801c88 <cprintf>

	if ((r = file_open("/not-found", &f)) < 0 && r != -E_NOT_FOUND)
  8017a4:	83 c4 08             	add    $0x8,%esp
  8017a7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017aa:	50                   	push   %eax
  8017ab:	68 15 3e 80 00       	push   $0x803e15
  8017b0:	e8 c1 f5 ff ff       	call   800d76 <file_open>
  8017b5:	83 c4 10             	add    $0x10,%esp
  8017b8:	83 f8 f5             	cmp    $0xfffffff5,%eax
  8017bb:	74 08                	je     8017c5 <fs_test+0xb6>
  8017bd:	85 c0                	test   %eax,%eax
  8017bf:	0f 88 26 02 00 00    	js     8019eb <fs_test+0x2dc>
		panic("file_open /not-found: %e", r);
	else if (r == 0)
  8017c5:	85 c0                	test   %eax,%eax
  8017c7:	0f 84 30 02 00 00    	je     8019fd <fs_test+0x2ee>
		panic("file_open /not-found succeeded!");
	if ((r = file_open("/newmotd", &f)) < 0)
  8017cd:	83 ec 08             	sub    $0x8,%esp
  8017d0:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017d3:	50                   	push   %eax
  8017d4:	68 39 3e 80 00       	push   $0x803e39
  8017d9:	e8 98 f5 ff ff       	call   800d76 <file_open>
  8017de:	83 c4 10             	add    $0x10,%esp
  8017e1:	85 c0                	test   %eax,%eax
  8017e3:	0f 88 28 02 00 00    	js     801a11 <fs_test+0x302>
		panic("file_open /newmotd: %e", r);
	cprintf("file_open is good\n");
  8017e9:	83 ec 0c             	sub    $0xc,%esp
  8017ec:	68 59 3e 80 00       	push   $0x803e59
  8017f1:	e8 92 04 00 00       	call   801c88 <cprintf>

	if ((r = file_get_block(f, 0, &blk)) < 0)
  8017f6:	83 c4 0c             	add    $0xc,%esp
  8017f9:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017fc:	50                   	push   %eax
  8017fd:	6a 00                	push   $0x0
  8017ff:	ff 75 f4             	pushl  -0xc(%ebp)
  801802:	e8 e6 f2 ff ff       	call   800aed <file_get_block>
  801807:	83 c4 10             	add    $0x10,%esp
  80180a:	85 c0                	test   %eax,%eax
  80180c:	0f 88 11 02 00 00    	js     801a23 <fs_test+0x314>
		panic("file_get_block: %e", r);
	if (strcmp(blk, msg) != 0)
  801812:	83 ec 08             	sub    $0x8,%esp
  801815:	68 a0 3f 80 00       	push   $0x803fa0
  80181a:	ff 75 f0             	pushl  -0x10(%ebp)
  80181d:	e8 fe 0a 00 00       	call   802320 <strcmp>
  801822:	83 c4 10             	add    $0x10,%esp
  801825:	85 c0                	test   %eax,%eax
  801827:	0f 85 08 02 00 00    	jne    801a35 <fs_test+0x326>
		panic("file_get_block returned wrong data");
	cprintf("file_get_block is good\n");
  80182d:	83 ec 0c             	sub    $0xc,%esp
  801830:	68 7f 3e 80 00       	push   $0x803e7f
  801835:	e8 4e 04 00 00       	call   801c88 <cprintf>

	*(volatile char*)blk = *(volatile char*)blk;
  80183a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80183d:	0f b6 10             	movzbl (%eax),%edx
  801840:	88 10                	mov    %dl,(%eax)
	assert((uvpt[PGNUM(blk)] & PTE_D));
  801842:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801845:	c1 e8 0c             	shr    $0xc,%eax
  801848:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80184f:	83 c4 10             	add    $0x10,%esp
  801852:	a8 40                	test   $0x40,%al
  801854:	0f 84 ef 01 00 00    	je     801a49 <fs_test+0x33a>
	file_flush(f);
  80185a:	83 ec 0c             	sub    $0xc,%esp
  80185d:	ff 75 f4             	pushl  -0xc(%ebp)
  801860:	e8 6a f7 ff ff       	call   800fcf <file_flush>
	assert(!(uvpt[PGNUM(blk)] & PTE_D));
  801865:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801868:	c1 e8 0c             	shr    $0xc,%eax
  80186b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801872:	83 c4 10             	add    $0x10,%esp
  801875:	a8 40                	test   $0x40,%al
  801877:	0f 85 e2 01 00 00    	jne    801a5f <fs_test+0x350>
	cprintf("file_flush is good\n");
  80187d:	83 ec 0c             	sub    $0xc,%esp
  801880:	68 b3 3e 80 00       	push   $0x803eb3
  801885:	e8 fe 03 00 00       	call   801c88 <cprintf>

	if ((r = file_set_size(f, 0)) < 0)
  80188a:	83 c4 08             	add    $0x8,%esp
  80188d:	6a 00                	push   $0x0
  80188f:	ff 75 f4             	pushl  -0xc(%ebp)
  801892:	e8 ab f5 ff ff       	call   800e42 <file_set_size>
  801897:	83 c4 10             	add    $0x10,%esp
  80189a:	85 c0                	test   %eax,%eax
  80189c:	0f 88 d3 01 00 00    	js     801a75 <fs_test+0x366>
		panic("file_set_size: %e", r);
	assert(f->f_direct[0] == 0);
  8018a2:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8018a5:	83 b8 88 00 00 00 00 	cmpl   $0x0,0x88(%eax)
  8018ac:	0f 85 d5 01 00 00    	jne    801a87 <fs_test+0x378>
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  8018b2:	c1 e8 0c             	shr    $0xc,%eax
  8018b5:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8018bc:	a8 40                	test   $0x40,%al
  8018be:	0f 85 d9 01 00 00    	jne    801a9d <fs_test+0x38e>
	cprintf("file_truncate is good\n");
  8018c4:	83 ec 0c             	sub    $0xc,%esp
  8018c7:	68 07 3f 80 00       	push   $0x803f07
  8018cc:	e8 b7 03 00 00       	call   801c88 <cprintf>

	if ((r = file_set_size(f, strlen(msg))) < 0)
  8018d1:	c7 04 24 a0 3f 80 00 	movl   $0x803fa0,(%esp)
  8018d8:	e8 41 09 00 00       	call   80221e <strlen>
  8018dd:	83 c4 08             	add    $0x8,%esp
  8018e0:	50                   	push   %eax
  8018e1:	ff 75 f4             	pushl  -0xc(%ebp)
  8018e4:	e8 59 f5 ff ff       	call   800e42 <file_set_size>
  8018e9:	83 c4 10             	add    $0x10,%esp
  8018ec:	85 c0                	test   %eax,%eax
  8018ee:	0f 88 bf 01 00 00    	js     801ab3 <fs_test+0x3a4>
		panic("file_set_size 2: %e", r);
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  8018f4:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8018f7:	89 c2                	mov    %eax,%edx
  8018f9:	c1 ea 0c             	shr    $0xc,%edx
  8018fc:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801903:	f6 c2 40             	test   $0x40,%dl
  801906:	0f 85 b9 01 00 00    	jne    801ac5 <fs_test+0x3b6>
	if ((r = file_get_block(f, 0, &blk)) < 0)
  80190c:	83 ec 04             	sub    $0x4,%esp
  80190f:	8d 55 f0             	lea    -0x10(%ebp),%edx
  801912:	52                   	push   %edx
  801913:	6a 00                	push   $0x0
  801915:	50                   	push   %eax
  801916:	e8 d2 f1 ff ff       	call   800aed <file_get_block>
  80191b:	83 c4 10             	add    $0x10,%esp
  80191e:	85 c0                	test   %eax,%eax
  801920:	0f 88 b5 01 00 00    	js     801adb <fs_test+0x3cc>
		panic("file_get_block 2: %e", r);
	strcpy(blk, msg);
  801926:	83 ec 08             	sub    $0x8,%esp
  801929:	68 a0 3f 80 00       	push   $0x803fa0
  80192e:	ff 75 f0             	pushl  -0x10(%ebp)
  801931:	e8 2b 09 00 00       	call   802261 <strcpy>
	assert((uvpt[PGNUM(blk)] & PTE_D));
  801936:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801939:	c1 e8 0c             	shr    $0xc,%eax
  80193c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801943:	83 c4 10             	add    $0x10,%esp
  801946:	a8 40                	test   $0x40,%al
  801948:	0f 84 9f 01 00 00    	je     801aed <fs_test+0x3de>
	file_flush(f);
  80194e:	83 ec 0c             	sub    $0xc,%esp
  801951:	ff 75 f4             	pushl  -0xc(%ebp)
  801954:	e8 76 f6 ff ff       	call   800fcf <file_flush>
	assert(!(uvpt[PGNUM(blk)] & PTE_D));
  801959:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80195c:	c1 e8 0c             	shr    $0xc,%eax
  80195f:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801966:	83 c4 10             	add    $0x10,%esp
  801969:	a8 40                	test   $0x40,%al
  80196b:	0f 85 92 01 00 00    	jne    801b03 <fs_test+0x3f4>
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  801971:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801974:	c1 e8 0c             	shr    $0xc,%eax
  801977:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80197e:	a8 40                	test   $0x40,%al
  801980:	0f 85 93 01 00 00    	jne    801b19 <fs_test+0x40a>
	cprintf("file rewrite is good\n");
  801986:	83 ec 0c             	sub    $0xc,%esp
  801989:	68 47 3f 80 00       	push   $0x803f47
  80198e:	e8 f5 02 00 00       	call   801c88 <cprintf>
}
  801993:	83 c4 10             	add    $0x10,%esp
  801996:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801999:	c9                   	leave  
  80199a:	c3                   	ret    
		panic("sys_page_alloc: %e", r);
  80199b:	50                   	push   %eax
  80199c:	68 b8 3d 80 00       	push   $0x803db8
  8019a1:	6a 12                	push   $0x12
  8019a3:	68 cb 3d 80 00       	push   $0x803dcb
  8019a8:	e8 f4 01 00 00       	call   801ba1 <_panic>
		panic("alloc_block: %e", r);
  8019ad:	50                   	push   %eax
  8019ae:	68 d5 3d 80 00       	push   $0x803dd5
  8019b3:	6a 17                	push   $0x17
  8019b5:	68 cb 3d 80 00       	push   $0x803dcb
  8019ba:	e8 e2 01 00 00       	call   801ba1 <_panic>
	assert(bits[r/32] & (1 << (r%32)));
  8019bf:	68 e5 3d 80 00       	push   $0x803de5
  8019c4:	68 9d 3a 80 00       	push   $0x803a9d
  8019c9:	6a 19                	push   $0x19
  8019cb:	68 cb 3d 80 00       	push   $0x803dcb
  8019d0:	e8 cc 01 00 00       	call   801ba1 <_panic>
	assert(!(bitmap[r/32] & (1 << (r%32))));
  8019d5:	68 60 3f 80 00       	push   $0x803f60
  8019da:	68 9d 3a 80 00       	push   $0x803a9d
  8019df:	6a 1b                	push   $0x1b
  8019e1:	68 cb 3d 80 00       	push   $0x803dcb
  8019e6:	e8 b6 01 00 00       	call   801ba1 <_panic>
		panic("file_open /not-found: %e", r);
  8019eb:	50                   	push   %eax
  8019ec:	68 20 3e 80 00       	push   $0x803e20
  8019f1:	6a 1f                	push   $0x1f
  8019f3:	68 cb 3d 80 00       	push   $0x803dcb
  8019f8:	e8 a4 01 00 00       	call   801ba1 <_panic>
		panic("file_open /not-found succeeded!");
  8019fd:	83 ec 04             	sub    $0x4,%esp
  801a00:	68 80 3f 80 00       	push   $0x803f80
  801a05:	6a 21                	push   $0x21
  801a07:	68 cb 3d 80 00       	push   $0x803dcb
  801a0c:	e8 90 01 00 00       	call   801ba1 <_panic>
		panic("file_open /newmotd: %e", r);
  801a11:	50                   	push   %eax
  801a12:	68 42 3e 80 00       	push   $0x803e42
  801a17:	6a 23                	push   $0x23
  801a19:	68 cb 3d 80 00       	push   $0x803dcb
  801a1e:	e8 7e 01 00 00       	call   801ba1 <_panic>
		panic("file_get_block: %e", r);
  801a23:	50                   	push   %eax
  801a24:	68 6c 3e 80 00       	push   $0x803e6c
  801a29:	6a 27                	push   $0x27
  801a2b:	68 cb 3d 80 00       	push   $0x803dcb
  801a30:	e8 6c 01 00 00       	call   801ba1 <_panic>
		panic("file_get_block returned wrong data");
  801a35:	83 ec 04             	sub    $0x4,%esp
  801a38:	68 c8 3f 80 00       	push   $0x803fc8
  801a3d:	6a 29                	push   $0x29
  801a3f:	68 cb 3d 80 00       	push   $0x803dcb
  801a44:	e8 58 01 00 00       	call   801ba1 <_panic>
	assert((uvpt[PGNUM(blk)] & PTE_D));
  801a49:	68 98 3e 80 00       	push   $0x803e98
  801a4e:	68 9d 3a 80 00       	push   $0x803a9d
  801a53:	6a 2d                	push   $0x2d
  801a55:	68 cb 3d 80 00       	push   $0x803dcb
  801a5a:	e8 42 01 00 00       	call   801ba1 <_panic>
	assert(!(uvpt[PGNUM(blk)] & PTE_D));
  801a5f:	68 97 3e 80 00       	push   $0x803e97
  801a64:	68 9d 3a 80 00       	push   $0x803a9d
  801a69:	6a 2f                	push   $0x2f
  801a6b:	68 cb 3d 80 00       	push   $0x803dcb
  801a70:	e8 2c 01 00 00       	call   801ba1 <_panic>
		panic("file_set_size: %e", r);
  801a75:	50                   	push   %eax
  801a76:	68 c7 3e 80 00       	push   $0x803ec7
  801a7b:	6a 33                	push   $0x33
  801a7d:	68 cb 3d 80 00       	push   $0x803dcb
  801a82:	e8 1a 01 00 00       	call   801ba1 <_panic>
	assert(f->f_direct[0] == 0);
  801a87:	68 d9 3e 80 00       	push   $0x803ed9
  801a8c:	68 9d 3a 80 00       	push   $0x803a9d
  801a91:	6a 34                	push   $0x34
  801a93:	68 cb 3d 80 00       	push   $0x803dcb
  801a98:	e8 04 01 00 00       	call   801ba1 <_panic>
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  801a9d:	68 ed 3e 80 00       	push   $0x803eed
  801aa2:	68 9d 3a 80 00       	push   $0x803a9d
  801aa7:	6a 35                	push   $0x35
  801aa9:	68 cb 3d 80 00       	push   $0x803dcb
  801aae:	e8 ee 00 00 00       	call   801ba1 <_panic>
		panic("file_set_size 2: %e", r);
  801ab3:	50                   	push   %eax
  801ab4:	68 1e 3f 80 00       	push   $0x803f1e
  801ab9:	6a 39                	push   $0x39
  801abb:	68 cb 3d 80 00       	push   $0x803dcb
  801ac0:	e8 dc 00 00 00       	call   801ba1 <_panic>
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  801ac5:	68 ed 3e 80 00       	push   $0x803eed
  801aca:	68 9d 3a 80 00       	push   $0x803a9d
  801acf:	6a 3a                	push   $0x3a
  801ad1:	68 cb 3d 80 00       	push   $0x803dcb
  801ad6:	e8 c6 00 00 00       	call   801ba1 <_panic>
		panic("file_get_block 2: %e", r);
  801adb:	50                   	push   %eax
  801adc:	68 32 3f 80 00       	push   $0x803f32
  801ae1:	6a 3c                	push   $0x3c
  801ae3:	68 cb 3d 80 00       	push   $0x803dcb
  801ae8:	e8 b4 00 00 00       	call   801ba1 <_panic>
	assert((uvpt[PGNUM(blk)] & PTE_D));
  801aed:	68 98 3e 80 00       	push   $0x803e98
  801af2:	68 9d 3a 80 00       	push   $0x803a9d
  801af7:	6a 3e                	push   $0x3e
  801af9:	68 cb 3d 80 00       	push   $0x803dcb
  801afe:	e8 9e 00 00 00       	call   801ba1 <_panic>
	assert(!(uvpt[PGNUM(blk)] & PTE_D));
  801b03:	68 97 3e 80 00       	push   $0x803e97
  801b08:	68 9d 3a 80 00       	push   $0x803a9d
  801b0d:	6a 40                	push   $0x40
  801b0f:	68 cb 3d 80 00       	push   $0x803dcb
  801b14:	e8 88 00 00 00       	call   801ba1 <_panic>
	assert(!(uvpt[PGNUM(f)] & PTE_D));
  801b19:	68 ed 3e 80 00       	push   $0x803eed
  801b1e:	68 9d 3a 80 00       	push   $0x803a9d
  801b23:	6a 41                	push   $0x41
  801b25:	68 cb 3d 80 00       	push   $0x803dcb
  801b2a:	e8 72 00 00 00       	call   801ba1 <_panic>

00801b2f <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  801b2f:	f3 0f 1e fb          	endbr32 
  801b33:	55                   	push   %ebp
  801b34:	89 e5                	mov    %esp,%ebp
  801b36:	56                   	push   %esi
  801b37:	53                   	push   %ebx
  801b38:	8b 5d 08             	mov    0x8(%ebp),%ebx
  801b3b:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  801b3e:	c7 05 0c a0 80 00 00 	movl   $0x0,0x80a00c
  801b45:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  801b48:	e8 10 0b 00 00       	call   80265d <sys_getenvid>
  801b4d:	25 ff 03 00 00       	and    $0x3ff,%eax
  801b52:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801b55:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801b5a:	a3 0c a0 80 00       	mov    %eax,0x80a00c

	// save the name of the program so that panic() can use it
	if (argc > 0)
  801b5f:	85 db                	test   %ebx,%ebx
  801b61:	7e 07                	jle    801b6a <libmain+0x3b>
		binaryname = argv[0];
  801b63:	8b 06                	mov    (%esi),%eax
  801b65:	a3 60 90 80 00       	mov    %eax,0x809060

	// call user main routine
	umain(argc, argv);
  801b6a:	83 ec 08             	sub    $0x8,%esp
  801b6d:	56                   	push   %esi
  801b6e:	53                   	push   %ebx
  801b6f:	e8 51 fb ff ff       	call   8016c5 <umain>

	// exit gracefully
	exit();
  801b74:	e8 0a 00 00 00       	call   801b83 <exit>
}
  801b79:	83 c4 10             	add    $0x10,%esp
  801b7c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b7f:	5b                   	pop    %ebx
  801b80:	5e                   	pop    %esi
  801b81:	5d                   	pop    %ebp
  801b82:	c3                   	ret    

00801b83 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  801b83:	f3 0f 1e fb          	endbr32 
  801b87:	55                   	push   %ebp
  801b88:	89 e5                	mov    %esp,%ebp
  801b8a:	83 ec 08             	sub    $0x8,%esp
	close_all();
  801b8d:	e8 c8 10 00 00       	call   802c5a <close_all>
	sys_env_destroy(0);
  801b92:	83 ec 0c             	sub    $0xc,%esp
  801b95:	6a 00                	push   $0x0
  801b97:	e8 7c 0a 00 00       	call   802618 <sys_env_destroy>
}
  801b9c:	83 c4 10             	add    $0x10,%esp
  801b9f:	c9                   	leave  
  801ba0:	c3                   	ret    

00801ba1 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801ba1:	f3 0f 1e fb          	endbr32 
  801ba5:	55                   	push   %ebp
  801ba6:	89 e5                	mov    %esp,%ebp
  801ba8:	56                   	push   %esi
  801ba9:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801baa:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801bad:	8b 35 60 90 80 00    	mov    0x809060,%esi
  801bb3:	e8 a5 0a 00 00       	call   80265d <sys_getenvid>
  801bb8:	83 ec 0c             	sub    $0xc,%esp
  801bbb:	ff 75 0c             	pushl  0xc(%ebp)
  801bbe:	ff 75 08             	pushl  0x8(%ebp)
  801bc1:	56                   	push   %esi
  801bc2:	50                   	push   %eax
  801bc3:	68 f8 3f 80 00       	push   $0x803ff8
  801bc8:	e8 bb 00 00 00       	call   801c88 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801bcd:	83 c4 18             	add    $0x18,%esp
  801bd0:	53                   	push   %ebx
  801bd1:	ff 75 10             	pushl  0x10(%ebp)
  801bd4:	e8 5a 00 00 00       	call   801c33 <vcprintf>
	cprintf("\n");
  801bd9:	c7 04 24 09 3c 80 00 	movl   $0x803c09,(%esp)
  801be0:	e8 a3 00 00 00       	call   801c88 <cprintf>
  801be5:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801be8:	cc                   	int3   
  801be9:	eb fd                	jmp    801be8 <_panic+0x47>

00801beb <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  801beb:	f3 0f 1e fb          	endbr32 
  801bef:	55                   	push   %ebp
  801bf0:	89 e5                	mov    %esp,%ebp
  801bf2:	53                   	push   %ebx
  801bf3:	83 ec 04             	sub    $0x4,%esp
  801bf6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  801bf9:	8b 13                	mov    (%ebx),%edx
  801bfb:	8d 42 01             	lea    0x1(%edx),%eax
  801bfe:	89 03                	mov    %eax,(%ebx)
  801c00:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801c03:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  801c07:	3d ff 00 00 00       	cmp    $0xff,%eax
  801c0c:	74 09                	je     801c17 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  801c0e:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  801c12:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801c15:	c9                   	leave  
  801c16:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  801c17:	83 ec 08             	sub    $0x8,%esp
  801c1a:	68 ff 00 00 00       	push   $0xff
  801c1f:	8d 43 08             	lea    0x8(%ebx),%eax
  801c22:	50                   	push   %eax
  801c23:	e8 ab 09 00 00       	call   8025d3 <sys_cputs>
		b->idx = 0;
  801c28:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801c2e:	83 c4 10             	add    $0x10,%esp
  801c31:	eb db                	jmp    801c0e <putch+0x23>

00801c33 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  801c33:	f3 0f 1e fb          	endbr32 
  801c37:	55                   	push   %ebp
  801c38:	89 e5                	mov    %esp,%ebp
  801c3a:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  801c40:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  801c47:	00 00 00 
	b.cnt = 0;
  801c4a:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  801c51:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  801c54:	ff 75 0c             	pushl  0xc(%ebp)
  801c57:	ff 75 08             	pushl  0x8(%ebp)
  801c5a:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  801c60:	50                   	push   %eax
  801c61:	68 eb 1b 80 00       	push   $0x801beb
  801c66:	e8 20 01 00 00       	call   801d8b <vprintfmt>
	sys_cputs(b.buf, b.idx);
  801c6b:	83 c4 08             	add    $0x8,%esp
  801c6e:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  801c74:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  801c7a:	50                   	push   %eax
  801c7b:	e8 53 09 00 00       	call   8025d3 <sys_cputs>

	return b.cnt;
}
  801c80:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  801c86:	c9                   	leave  
  801c87:	c3                   	ret    

00801c88 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  801c88:	f3 0f 1e fb          	endbr32 
  801c8c:	55                   	push   %ebp
  801c8d:	89 e5                	mov    %esp,%ebp
  801c8f:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  801c92:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  801c95:	50                   	push   %eax
  801c96:	ff 75 08             	pushl  0x8(%ebp)
  801c99:	e8 95 ff ff ff       	call   801c33 <vcprintf>
	va_end(ap);

	return cnt;
}
  801c9e:	c9                   	leave  
  801c9f:	c3                   	ret    

00801ca0 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  801ca0:	55                   	push   %ebp
  801ca1:	89 e5                	mov    %esp,%ebp
  801ca3:	57                   	push   %edi
  801ca4:	56                   	push   %esi
  801ca5:	53                   	push   %ebx
  801ca6:	83 ec 1c             	sub    $0x1c,%esp
  801ca9:	89 c7                	mov    %eax,%edi
  801cab:	89 d6                	mov    %edx,%esi
  801cad:	8b 45 08             	mov    0x8(%ebp),%eax
  801cb0:	8b 55 0c             	mov    0xc(%ebp),%edx
  801cb3:	89 d1                	mov    %edx,%ecx
  801cb5:	89 c2                	mov    %eax,%edx
  801cb7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801cba:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  801cbd:	8b 45 10             	mov    0x10(%ebp),%eax
  801cc0:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  801cc3:	89 45 e0             	mov    %eax,-0x20(%ebp)
  801cc6:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  801ccd:	39 c2                	cmp    %eax,%edx
  801ccf:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  801cd2:	72 3e                	jb     801d12 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  801cd4:	83 ec 0c             	sub    $0xc,%esp
  801cd7:	ff 75 18             	pushl  0x18(%ebp)
  801cda:	83 eb 01             	sub    $0x1,%ebx
  801cdd:	53                   	push   %ebx
  801cde:	50                   	push   %eax
  801cdf:	83 ec 08             	sub    $0x8,%esp
  801ce2:	ff 75 e4             	pushl  -0x1c(%ebp)
  801ce5:	ff 75 e0             	pushl  -0x20(%ebp)
  801ce8:	ff 75 dc             	pushl  -0x24(%ebp)
  801ceb:	ff 75 d8             	pushl  -0x28(%ebp)
  801cee:	e8 fd 1a 00 00       	call   8037f0 <__udivdi3>
  801cf3:	83 c4 18             	add    $0x18,%esp
  801cf6:	52                   	push   %edx
  801cf7:	50                   	push   %eax
  801cf8:	89 f2                	mov    %esi,%edx
  801cfa:	89 f8                	mov    %edi,%eax
  801cfc:	e8 9f ff ff ff       	call   801ca0 <printnum>
  801d01:	83 c4 20             	add    $0x20,%esp
  801d04:	eb 13                	jmp    801d19 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  801d06:	83 ec 08             	sub    $0x8,%esp
  801d09:	56                   	push   %esi
  801d0a:	ff 75 18             	pushl  0x18(%ebp)
  801d0d:	ff d7                	call   *%edi
  801d0f:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  801d12:	83 eb 01             	sub    $0x1,%ebx
  801d15:	85 db                	test   %ebx,%ebx
  801d17:	7f ed                	jg     801d06 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  801d19:	83 ec 08             	sub    $0x8,%esp
  801d1c:	56                   	push   %esi
  801d1d:	83 ec 04             	sub    $0x4,%esp
  801d20:	ff 75 e4             	pushl  -0x1c(%ebp)
  801d23:	ff 75 e0             	pushl  -0x20(%ebp)
  801d26:	ff 75 dc             	pushl  -0x24(%ebp)
  801d29:	ff 75 d8             	pushl  -0x28(%ebp)
  801d2c:	e8 cf 1b 00 00       	call   803900 <__umoddi3>
  801d31:	83 c4 14             	add    $0x14,%esp
  801d34:	0f be 80 1b 40 80 00 	movsbl 0x80401b(%eax),%eax
  801d3b:	50                   	push   %eax
  801d3c:	ff d7                	call   *%edi
}
  801d3e:	83 c4 10             	add    $0x10,%esp
  801d41:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d44:	5b                   	pop    %ebx
  801d45:	5e                   	pop    %esi
  801d46:	5f                   	pop    %edi
  801d47:	5d                   	pop    %ebp
  801d48:	c3                   	ret    

00801d49 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  801d49:	f3 0f 1e fb          	endbr32 
  801d4d:	55                   	push   %ebp
  801d4e:	89 e5                	mov    %esp,%ebp
  801d50:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  801d53:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  801d57:	8b 10                	mov    (%eax),%edx
  801d59:	3b 50 04             	cmp    0x4(%eax),%edx
  801d5c:	73 0a                	jae    801d68 <sprintputch+0x1f>
		*b->buf++ = ch;
  801d5e:	8d 4a 01             	lea    0x1(%edx),%ecx
  801d61:	89 08                	mov    %ecx,(%eax)
  801d63:	8b 45 08             	mov    0x8(%ebp),%eax
  801d66:	88 02                	mov    %al,(%edx)
}
  801d68:	5d                   	pop    %ebp
  801d69:	c3                   	ret    

00801d6a <printfmt>:
{
  801d6a:	f3 0f 1e fb          	endbr32 
  801d6e:	55                   	push   %ebp
  801d6f:	89 e5                	mov    %esp,%ebp
  801d71:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  801d74:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  801d77:	50                   	push   %eax
  801d78:	ff 75 10             	pushl  0x10(%ebp)
  801d7b:	ff 75 0c             	pushl  0xc(%ebp)
  801d7e:	ff 75 08             	pushl  0x8(%ebp)
  801d81:	e8 05 00 00 00       	call   801d8b <vprintfmt>
}
  801d86:	83 c4 10             	add    $0x10,%esp
  801d89:	c9                   	leave  
  801d8a:	c3                   	ret    

00801d8b <vprintfmt>:
{
  801d8b:	f3 0f 1e fb          	endbr32 
  801d8f:	55                   	push   %ebp
  801d90:	89 e5                	mov    %esp,%ebp
  801d92:	57                   	push   %edi
  801d93:	56                   	push   %esi
  801d94:	53                   	push   %ebx
  801d95:	83 ec 3c             	sub    $0x3c,%esp
  801d98:	8b 75 08             	mov    0x8(%ebp),%esi
  801d9b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  801d9e:	8b 7d 10             	mov    0x10(%ebp),%edi
  801da1:	e9 5d 03 00 00       	jmp    802103 <vprintfmt+0x378>
		padc = ' ';
  801da6:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  801daa:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  801db1:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  801db8:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  801dbf:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  801dc4:	8d 47 01             	lea    0x1(%edi),%eax
  801dc7:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801dca:	0f b6 17             	movzbl (%edi),%edx
  801dcd:	8d 42 dd             	lea    -0x23(%edx),%eax
  801dd0:	3c 55                	cmp    $0x55,%al
  801dd2:	0f 87 ae 03 00 00    	ja     802186 <vprintfmt+0x3fb>
  801dd8:	0f b6 c0             	movzbl %al,%eax
  801ddb:	3e ff 24 85 60 41 80 	notrack jmp *0x804160(,%eax,4)
  801de2:	00 
  801de3:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  801de6:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  801dea:	eb d8                	jmp    801dc4 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  801dec:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  801def:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  801df3:	eb cf                	jmp    801dc4 <vprintfmt+0x39>
  801df5:	0f b6 d2             	movzbl %dl,%edx
  801df8:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  801dfb:	b8 00 00 00 00       	mov    $0x0,%eax
  801e00:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  801e03:	8d 04 80             	lea    (%eax,%eax,4),%eax
  801e06:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  801e0a:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  801e0d:	8d 4a d0             	lea    -0x30(%edx),%ecx
  801e10:	83 f9 09             	cmp    $0x9,%ecx
  801e13:	77 55                	ja     801e6a <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  801e15:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  801e18:	eb e9                	jmp    801e03 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  801e1a:	8b 45 14             	mov    0x14(%ebp),%eax
  801e1d:	8b 00                	mov    (%eax),%eax
  801e1f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801e22:	8b 45 14             	mov    0x14(%ebp),%eax
  801e25:	8d 40 04             	lea    0x4(%eax),%eax
  801e28:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  801e2b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  801e2e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  801e32:	79 90                	jns    801dc4 <vprintfmt+0x39>
				width = precision, precision = -1;
  801e34:	8b 45 d8             	mov    -0x28(%ebp),%eax
  801e37:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  801e3a:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  801e41:	eb 81                	jmp    801dc4 <vprintfmt+0x39>
  801e43:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  801e46:	85 c0                	test   %eax,%eax
  801e48:	ba 00 00 00 00       	mov    $0x0,%edx
  801e4d:	0f 49 d0             	cmovns %eax,%edx
  801e50:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  801e53:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  801e56:	e9 69 ff ff ff       	jmp    801dc4 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  801e5b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  801e5e:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  801e65:	e9 5a ff ff ff       	jmp    801dc4 <vprintfmt+0x39>
  801e6a:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  801e6d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801e70:	eb bc                	jmp    801e2e <vprintfmt+0xa3>
			lflag++;
  801e72:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  801e75:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  801e78:	e9 47 ff ff ff       	jmp    801dc4 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  801e7d:	8b 45 14             	mov    0x14(%ebp),%eax
  801e80:	8d 78 04             	lea    0x4(%eax),%edi
  801e83:	83 ec 08             	sub    $0x8,%esp
  801e86:	53                   	push   %ebx
  801e87:	ff 30                	pushl  (%eax)
  801e89:	ff d6                	call   *%esi
			break;
  801e8b:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  801e8e:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  801e91:	e9 6a 02 00 00       	jmp    802100 <vprintfmt+0x375>
			err = va_arg(ap, int);
  801e96:	8b 45 14             	mov    0x14(%ebp),%eax
  801e99:	8d 78 04             	lea    0x4(%eax),%edi
  801e9c:	8b 00                	mov    (%eax),%eax
  801e9e:	99                   	cltd   
  801e9f:	31 d0                	xor    %edx,%eax
  801ea1:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  801ea3:	83 f8 0f             	cmp    $0xf,%eax
  801ea6:	7f 23                	jg     801ecb <vprintfmt+0x140>
  801ea8:	8b 14 85 c0 42 80 00 	mov    0x8042c0(,%eax,4),%edx
  801eaf:	85 d2                	test   %edx,%edx
  801eb1:	74 18                	je     801ecb <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  801eb3:	52                   	push   %edx
  801eb4:	68 af 3a 80 00       	push   $0x803aaf
  801eb9:	53                   	push   %ebx
  801eba:	56                   	push   %esi
  801ebb:	e8 aa fe ff ff       	call   801d6a <printfmt>
  801ec0:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  801ec3:	89 7d 14             	mov    %edi,0x14(%ebp)
  801ec6:	e9 35 02 00 00       	jmp    802100 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  801ecb:	50                   	push   %eax
  801ecc:	68 33 40 80 00       	push   $0x804033
  801ed1:	53                   	push   %ebx
  801ed2:	56                   	push   %esi
  801ed3:	e8 92 fe ff ff       	call   801d6a <printfmt>
  801ed8:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  801edb:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  801ede:	e9 1d 02 00 00       	jmp    802100 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  801ee3:	8b 45 14             	mov    0x14(%ebp),%eax
  801ee6:	83 c0 04             	add    $0x4,%eax
  801ee9:	89 45 c8             	mov    %eax,-0x38(%ebp)
  801eec:	8b 45 14             	mov    0x14(%ebp),%eax
  801eef:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  801ef1:	85 d2                	test   %edx,%edx
  801ef3:	b8 2c 40 80 00       	mov    $0x80402c,%eax
  801ef8:	0f 45 c2             	cmovne %edx,%eax
  801efb:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  801efe:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  801f02:	7e 06                	jle    801f0a <vprintfmt+0x17f>
  801f04:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  801f08:	75 0d                	jne    801f17 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  801f0a:	8b 45 cc             	mov    -0x34(%ebp),%eax
  801f0d:	89 c7                	mov    %eax,%edi
  801f0f:	03 45 d4             	add    -0x2c(%ebp),%eax
  801f12:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  801f15:	eb 55                	jmp    801f6c <vprintfmt+0x1e1>
  801f17:	83 ec 08             	sub    $0x8,%esp
  801f1a:	ff 75 d8             	pushl  -0x28(%ebp)
  801f1d:	ff 75 cc             	pushl  -0x34(%ebp)
  801f20:	e8 15 03 00 00       	call   80223a <strnlen>
  801f25:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  801f28:	29 c2                	sub    %eax,%edx
  801f2a:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  801f2d:	83 c4 10             	add    $0x10,%esp
  801f30:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  801f32:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  801f36:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  801f39:	85 ff                	test   %edi,%edi
  801f3b:	7e 11                	jle    801f4e <vprintfmt+0x1c3>
					putch(padc, putdat);
  801f3d:	83 ec 08             	sub    $0x8,%esp
  801f40:	53                   	push   %ebx
  801f41:	ff 75 d4             	pushl  -0x2c(%ebp)
  801f44:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  801f46:	83 ef 01             	sub    $0x1,%edi
  801f49:	83 c4 10             	add    $0x10,%esp
  801f4c:	eb eb                	jmp    801f39 <vprintfmt+0x1ae>
  801f4e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  801f51:	85 d2                	test   %edx,%edx
  801f53:	b8 00 00 00 00       	mov    $0x0,%eax
  801f58:	0f 49 c2             	cmovns %edx,%eax
  801f5b:	29 c2                	sub    %eax,%edx
  801f5d:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  801f60:	eb a8                	jmp    801f0a <vprintfmt+0x17f>
					putch(ch, putdat);
  801f62:	83 ec 08             	sub    $0x8,%esp
  801f65:	53                   	push   %ebx
  801f66:	52                   	push   %edx
  801f67:	ff d6                	call   *%esi
  801f69:	83 c4 10             	add    $0x10,%esp
  801f6c:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  801f6f:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  801f71:	83 c7 01             	add    $0x1,%edi
  801f74:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  801f78:	0f be d0             	movsbl %al,%edx
  801f7b:	85 d2                	test   %edx,%edx
  801f7d:	74 4b                	je     801fca <vprintfmt+0x23f>
  801f7f:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  801f83:	78 06                	js     801f8b <vprintfmt+0x200>
  801f85:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  801f89:	78 1e                	js     801fa9 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  801f8b:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  801f8f:	74 d1                	je     801f62 <vprintfmt+0x1d7>
  801f91:	0f be c0             	movsbl %al,%eax
  801f94:	83 e8 20             	sub    $0x20,%eax
  801f97:	83 f8 5e             	cmp    $0x5e,%eax
  801f9a:	76 c6                	jbe    801f62 <vprintfmt+0x1d7>
					putch('?', putdat);
  801f9c:	83 ec 08             	sub    $0x8,%esp
  801f9f:	53                   	push   %ebx
  801fa0:	6a 3f                	push   $0x3f
  801fa2:	ff d6                	call   *%esi
  801fa4:	83 c4 10             	add    $0x10,%esp
  801fa7:	eb c3                	jmp    801f6c <vprintfmt+0x1e1>
  801fa9:	89 cf                	mov    %ecx,%edi
  801fab:	eb 0e                	jmp    801fbb <vprintfmt+0x230>
				putch(' ', putdat);
  801fad:	83 ec 08             	sub    $0x8,%esp
  801fb0:	53                   	push   %ebx
  801fb1:	6a 20                	push   $0x20
  801fb3:	ff d6                	call   *%esi
			for (; width > 0; width--)
  801fb5:	83 ef 01             	sub    $0x1,%edi
  801fb8:	83 c4 10             	add    $0x10,%esp
  801fbb:	85 ff                	test   %edi,%edi
  801fbd:	7f ee                	jg     801fad <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  801fbf:	8b 45 c8             	mov    -0x38(%ebp),%eax
  801fc2:	89 45 14             	mov    %eax,0x14(%ebp)
  801fc5:	e9 36 01 00 00       	jmp    802100 <vprintfmt+0x375>
  801fca:	89 cf                	mov    %ecx,%edi
  801fcc:	eb ed                	jmp    801fbb <vprintfmt+0x230>
	if (lflag >= 2)
  801fce:	83 f9 01             	cmp    $0x1,%ecx
  801fd1:	7f 1f                	jg     801ff2 <vprintfmt+0x267>
	else if (lflag)
  801fd3:	85 c9                	test   %ecx,%ecx
  801fd5:	74 67                	je     80203e <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  801fd7:	8b 45 14             	mov    0x14(%ebp),%eax
  801fda:	8b 00                	mov    (%eax),%eax
  801fdc:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801fdf:	89 c1                	mov    %eax,%ecx
  801fe1:	c1 f9 1f             	sar    $0x1f,%ecx
  801fe4:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  801fe7:	8b 45 14             	mov    0x14(%ebp),%eax
  801fea:	8d 40 04             	lea    0x4(%eax),%eax
  801fed:	89 45 14             	mov    %eax,0x14(%ebp)
  801ff0:	eb 17                	jmp    802009 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  801ff2:	8b 45 14             	mov    0x14(%ebp),%eax
  801ff5:	8b 50 04             	mov    0x4(%eax),%edx
  801ff8:	8b 00                	mov    (%eax),%eax
  801ffa:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801ffd:	89 55 dc             	mov    %edx,-0x24(%ebp)
  802000:	8b 45 14             	mov    0x14(%ebp),%eax
  802003:	8d 40 08             	lea    0x8(%eax),%eax
  802006:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  802009:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80200c:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80200f:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  802014:	85 c9                	test   %ecx,%ecx
  802016:	0f 89 ca 00 00 00    	jns    8020e6 <vprintfmt+0x35b>
				putch('-', putdat);
  80201c:	83 ec 08             	sub    $0x8,%esp
  80201f:	53                   	push   %ebx
  802020:	6a 2d                	push   $0x2d
  802022:	ff d6                	call   *%esi
				num = -(long long) num;
  802024:	8b 55 d8             	mov    -0x28(%ebp),%edx
  802027:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  80202a:	f7 da                	neg    %edx
  80202c:	83 d1 00             	adc    $0x0,%ecx
  80202f:	f7 d9                	neg    %ecx
  802031:	83 c4 10             	add    $0x10,%esp
			base = 10;
  802034:	b8 0a 00 00 00       	mov    $0xa,%eax
  802039:	e9 a8 00 00 00       	jmp    8020e6 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80203e:	8b 45 14             	mov    0x14(%ebp),%eax
  802041:	8b 00                	mov    (%eax),%eax
  802043:	89 45 d8             	mov    %eax,-0x28(%ebp)
  802046:	99                   	cltd   
  802047:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80204a:	8b 45 14             	mov    0x14(%ebp),%eax
  80204d:	8d 40 04             	lea    0x4(%eax),%eax
  802050:	89 45 14             	mov    %eax,0x14(%ebp)
  802053:	eb b4                	jmp    802009 <vprintfmt+0x27e>
	if (lflag >= 2)
  802055:	83 f9 01             	cmp    $0x1,%ecx
  802058:	7f 1b                	jg     802075 <vprintfmt+0x2ea>
	else if (lflag)
  80205a:	85 c9                	test   %ecx,%ecx
  80205c:	74 2c                	je     80208a <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80205e:	8b 45 14             	mov    0x14(%ebp),%eax
  802061:	8b 10                	mov    (%eax),%edx
  802063:	b9 00 00 00 00       	mov    $0x0,%ecx
  802068:	8d 40 04             	lea    0x4(%eax),%eax
  80206b:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80206e:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  802073:	eb 71                	jmp    8020e6 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  802075:	8b 45 14             	mov    0x14(%ebp),%eax
  802078:	8b 10                	mov    (%eax),%edx
  80207a:	8b 48 04             	mov    0x4(%eax),%ecx
  80207d:	8d 40 08             	lea    0x8(%eax),%eax
  802080:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  802083:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  802088:	eb 5c                	jmp    8020e6 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80208a:	8b 45 14             	mov    0x14(%ebp),%eax
  80208d:	8b 10                	mov    (%eax),%edx
  80208f:	b9 00 00 00 00       	mov    $0x0,%ecx
  802094:	8d 40 04             	lea    0x4(%eax),%eax
  802097:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80209a:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80209f:	eb 45                	jmp    8020e6 <vprintfmt+0x35b>
			putch('X', putdat);
  8020a1:	83 ec 08             	sub    $0x8,%esp
  8020a4:	53                   	push   %ebx
  8020a5:	6a 58                	push   $0x58
  8020a7:	ff d6                	call   *%esi
			putch('X', putdat);
  8020a9:	83 c4 08             	add    $0x8,%esp
  8020ac:	53                   	push   %ebx
  8020ad:	6a 58                	push   $0x58
  8020af:	ff d6                	call   *%esi
			putch('X', putdat);
  8020b1:	83 c4 08             	add    $0x8,%esp
  8020b4:	53                   	push   %ebx
  8020b5:	6a 58                	push   $0x58
  8020b7:	ff d6                	call   *%esi
			break;
  8020b9:	83 c4 10             	add    $0x10,%esp
  8020bc:	eb 42                	jmp    802100 <vprintfmt+0x375>
			putch('0', putdat);
  8020be:	83 ec 08             	sub    $0x8,%esp
  8020c1:	53                   	push   %ebx
  8020c2:	6a 30                	push   $0x30
  8020c4:	ff d6                	call   *%esi
			putch('x', putdat);
  8020c6:	83 c4 08             	add    $0x8,%esp
  8020c9:	53                   	push   %ebx
  8020ca:	6a 78                	push   $0x78
  8020cc:	ff d6                	call   *%esi
			num = (unsigned long long)
  8020ce:	8b 45 14             	mov    0x14(%ebp),%eax
  8020d1:	8b 10                	mov    (%eax),%edx
  8020d3:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  8020d8:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  8020db:	8d 40 04             	lea    0x4(%eax),%eax
  8020de:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8020e1:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  8020e6:	83 ec 0c             	sub    $0xc,%esp
  8020e9:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  8020ed:	57                   	push   %edi
  8020ee:	ff 75 d4             	pushl  -0x2c(%ebp)
  8020f1:	50                   	push   %eax
  8020f2:	51                   	push   %ecx
  8020f3:	52                   	push   %edx
  8020f4:	89 da                	mov    %ebx,%edx
  8020f6:	89 f0                	mov    %esi,%eax
  8020f8:	e8 a3 fb ff ff       	call   801ca0 <printnum>
			break;
  8020fd:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  802100:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  802103:	83 c7 01             	add    $0x1,%edi
  802106:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  80210a:	83 f8 25             	cmp    $0x25,%eax
  80210d:	0f 84 93 fc ff ff    	je     801da6 <vprintfmt+0x1b>
			if (ch == '\0')
  802113:	85 c0                	test   %eax,%eax
  802115:	0f 84 8b 00 00 00    	je     8021a6 <vprintfmt+0x41b>
			putch(ch, putdat);
  80211b:	83 ec 08             	sub    $0x8,%esp
  80211e:	53                   	push   %ebx
  80211f:	50                   	push   %eax
  802120:	ff d6                	call   *%esi
  802122:	83 c4 10             	add    $0x10,%esp
  802125:	eb dc                	jmp    802103 <vprintfmt+0x378>
	if (lflag >= 2)
  802127:	83 f9 01             	cmp    $0x1,%ecx
  80212a:	7f 1b                	jg     802147 <vprintfmt+0x3bc>
	else if (lflag)
  80212c:	85 c9                	test   %ecx,%ecx
  80212e:	74 2c                	je     80215c <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  802130:	8b 45 14             	mov    0x14(%ebp),%eax
  802133:	8b 10                	mov    (%eax),%edx
  802135:	b9 00 00 00 00       	mov    $0x0,%ecx
  80213a:	8d 40 04             	lea    0x4(%eax),%eax
  80213d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  802140:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  802145:	eb 9f                	jmp    8020e6 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  802147:	8b 45 14             	mov    0x14(%ebp),%eax
  80214a:	8b 10                	mov    (%eax),%edx
  80214c:	8b 48 04             	mov    0x4(%eax),%ecx
  80214f:	8d 40 08             	lea    0x8(%eax),%eax
  802152:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  802155:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  80215a:	eb 8a                	jmp    8020e6 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80215c:	8b 45 14             	mov    0x14(%ebp),%eax
  80215f:	8b 10                	mov    (%eax),%edx
  802161:	b9 00 00 00 00       	mov    $0x0,%ecx
  802166:	8d 40 04             	lea    0x4(%eax),%eax
  802169:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80216c:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  802171:	e9 70 ff ff ff       	jmp    8020e6 <vprintfmt+0x35b>
			putch(ch, putdat);
  802176:	83 ec 08             	sub    $0x8,%esp
  802179:	53                   	push   %ebx
  80217a:	6a 25                	push   $0x25
  80217c:	ff d6                	call   *%esi
			break;
  80217e:	83 c4 10             	add    $0x10,%esp
  802181:	e9 7a ff ff ff       	jmp    802100 <vprintfmt+0x375>
			putch('%', putdat);
  802186:	83 ec 08             	sub    $0x8,%esp
  802189:	53                   	push   %ebx
  80218a:	6a 25                	push   $0x25
  80218c:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80218e:	83 c4 10             	add    $0x10,%esp
  802191:	89 f8                	mov    %edi,%eax
  802193:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  802197:	74 05                	je     80219e <vprintfmt+0x413>
  802199:	83 e8 01             	sub    $0x1,%eax
  80219c:	eb f5                	jmp    802193 <vprintfmt+0x408>
  80219e:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8021a1:	e9 5a ff ff ff       	jmp    802100 <vprintfmt+0x375>
}
  8021a6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8021a9:	5b                   	pop    %ebx
  8021aa:	5e                   	pop    %esi
  8021ab:	5f                   	pop    %edi
  8021ac:	5d                   	pop    %ebp
  8021ad:	c3                   	ret    

008021ae <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8021ae:	f3 0f 1e fb          	endbr32 
  8021b2:	55                   	push   %ebp
  8021b3:	89 e5                	mov    %esp,%ebp
  8021b5:	83 ec 18             	sub    $0x18,%esp
  8021b8:	8b 45 08             	mov    0x8(%ebp),%eax
  8021bb:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  8021be:	89 45 ec             	mov    %eax,-0x14(%ebp)
  8021c1:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  8021c5:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  8021c8:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  8021cf:	85 c0                	test   %eax,%eax
  8021d1:	74 26                	je     8021f9 <vsnprintf+0x4b>
  8021d3:	85 d2                	test   %edx,%edx
  8021d5:	7e 22                	jle    8021f9 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  8021d7:	ff 75 14             	pushl  0x14(%ebp)
  8021da:	ff 75 10             	pushl  0x10(%ebp)
  8021dd:	8d 45 ec             	lea    -0x14(%ebp),%eax
  8021e0:	50                   	push   %eax
  8021e1:	68 49 1d 80 00       	push   $0x801d49
  8021e6:	e8 a0 fb ff ff       	call   801d8b <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  8021eb:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8021ee:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  8021f1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8021f4:	83 c4 10             	add    $0x10,%esp
}
  8021f7:	c9                   	leave  
  8021f8:	c3                   	ret    
		return -E_INVAL;
  8021f9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8021fe:	eb f7                	jmp    8021f7 <vsnprintf+0x49>

00802200 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  802200:	f3 0f 1e fb          	endbr32 
  802204:	55                   	push   %ebp
  802205:	89 e5                	mov    %esp,%ebp
  802207:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  80220a:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80220d:	50                   	push   %eax
  80220e:	ff 75 10             	pushl  0x10(%ebp)
  802211:	ff 75 0c             	pushl  0xc(%ebp)
  802214:	ff 75 08             	pushl  0x8(%ebp)
  802217:	e8 92 ff ff ff       	call   8021ae <vsnprintf>
	va_end(ap);

	return rc;
}
  80221c:	c9                   	leave  
  80221d:	c3                   	ret    

0080221e <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  80221e:	f3 0f 1e fb          	endbr32 
  802222:	55                   	push   %ebp
  802223:	89 e5                	mov    %esp,%ebp
  802225:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  802228:	b8 00 00 00 00       	mov    $0x0,%eax
  80222d:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  802231:	74 05                	je     802238 <strlen+0x1a>
		n++;
  802233:	83 c0 01             	add    $0x1,%eax
  802236:	eb f5                	jmp    80222d <strlen+0xf>
	return n;
}
  802238:	5d                   	pop    %ebp
  802239:	c3                   	ret    

0080223a <strnlen>:

int
strnlen(const char *s, size_t size)
{
  80223a:	f3 0f 1e fb          	endbr32 
  80223e:	55                   	push   %ebp
  80223f:	89 e5                	mov    %esp,%ebp
  802241:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802244:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  802247:	b8 00 00 00 00       	mov    $0x0,%eax
  80224c:	39 d0                	cmp    %edx,%eax
  80224e:	74 0d                	je     80225d <strnlen+0x23>
  802250:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  802254:	74 05                	je     80225b <strnlen+0x21>
		n++;
  802256:	83 c0 01             	add    $0x1,%eax
  802259:	eb f1                	jmp    80224c <strnlen+0x12>
  80225b:	89 c2                	mov    %eax,%edx
	return n;
}
  80225d:	89 d0                	mov    %edx,%eax
  80225f:	5d                   	pop    %ebp
  802260:	c3                   	ret    

00802261 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  802261:	f3 0f 1e fb          	endbr32 
  802265:	55                   	push   %ebp
  802266:	89 e5                	mov    %esp,%ebp
  802268:	53                   	push   %ebx
  802269:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80226c:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80226f:	b8 00 00 00 00       	mov    $0x0,%eax
  802274:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  802278:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80227b:	83 c0 01             	add    $0x1,%eax
  80227e:	84 d2                	test   %dl,%dl
  802280:	75 f2                	jne    802274 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  802282:	89 c8                	mov    %ecx,%eax
  802284:	5b                   	pop    %ebx
  802285:	5d                   	pop    %ebp
  802286:	c3                   	ret    

00802287 <strcat>:

char *
strcat(char *dst, const char *src)
{
  802287:	f3 0f 1e fb          	endbr32 
  80228b:	55                   	push   %ebp
  80228c:	89 e5                	mov    %esp,%ebp
  80228e:	53                   	push   %ebx
  80228f:	83 ec 10             	sub    $0x10,%esp
  802292:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  802295:	53                   	push   %ebx
  802296:	e8 83 ff ff ff       	call   80221e <strlen>
  80229b:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80229e:	ff 75 0c             	pushl  0xc(%ebp)
  8022a1:	01 d8                	add    %ebx,%eax
  8022a3:	50                   	push   %eax
  8022a4:	e8 b8 ff ff ff       	call   802261 <strcpy>
	return dst;
}
  8022a9:	89 d8                	mov    %ebx,%eax
  8022ab:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8022ae:	c9                   	leave  
  8022af:	c3                   	ret    

008022b0 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  8022b0:	f3 0f 1e fb          	endbr32 
  8022b4:	55                   	push   %ebp
  8022b5:	89 e5                	mov    %esp,%ebp
  8022b7:	56                   	push   %esi
  8022b8:	53                   	push   %ebx
  8022b9:	8b 75 08             	mov    0x8(%ebp),%esi
  8022bc:	8b 55 0c             	mov    0xc(%ebp),%edx
  8022bf:	89 f3                	mov    %esi,%ebx
  8022c1:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  8022c4:	89 f0                	mov    %esi,%eax
  8022c6:	39 d8                	cmp    %ebx,%eax
  8022c8:	74 11                	je     8022db <strncpy+0x2b>
		*dst++ = *src;
  8022ca:	83 c0 01             	add    $0x1,%eax
  8022cd:	0f b6 0a             	movzbl (%edx),%ecx
  8022d0:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  8022d3:	80 f9 01             	cmp    $0x1,%cl
  8022d6:	83 da ff             	sbb    $0xffffffff,%edx
  8022d9:	eb eb                	jmp    8022c6 <strncpy+0x16>
	}
	return ret;
}
  8022db:	89 f0                	mov    %esi,%eax
  8022dd:	5b                   	pop    %ebx
  8022de:	5e                   	pop    %esi
  8022df:	5d                   	pop    %ebp
  8022e0:	c3                   	ret    

008022e1 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  8022e1:	f3 0f 1e fb          	endbr32 
  8022e5:	55                   	push   %ebp
  8022e6:	89 e5                	mov    %esp,%ebp
  8022e8:	56                   	push   %esi
  8022e9:	53                   	push   %ebx
  8022ea:	8b 75 08             	mov    0x8(%ebp),%esi
  8022ed:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8022f0:	8b 55 10             	mov    0x10(%ebp),%edx
  8022f3:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  8022f5:	85 d2                	test   %edx,%edx
  8022f7:	74 21                	je     80231a <strlcpy+0x39>
  8022f9:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8022fd:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8022ff:	39 c2                	cmp    %eax,%edx
  802301:	74 14                	je     802317 <strlcpy+0x36>
  802303:	0f b6 19             	movzbl (%ecx),%ebx
  802306:	84 db                	test   %bl,%bl
  802308:	74 0b                	je     802315 <strlcpy+0x34>
			*dst++ = *src++;
  80230a:	83 c1 01             	add    $0x1,%ecx
  80230d:	83 c2 01             	add    $0x1,%edx
  802310:	88 5a ff             	mov    %bl,-0x1(%edx)
  802313:	eb ea                	jmp    8022ff <strlcpy+0x1e>
  802315:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  802317:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  80231a:	29 f0                	sub    %esi,%eax
}
  80231c:	5b                   	pop    %ebx
  80231d:	5e                   	pop    %esi
  80231e:	5d                   	pop    %ebp
  80231f:	c3                   	ret    

00802320 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  802320:	f3 0f 1e fb          	endbr32 
  802324:	55                   	push   %ebp
  802325:	89 e5                	mov    %esp,%ebp
  802327:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80232a:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  80232d:	0f b6 01             	movzbl (%ecx),%eax
  802330:	84 c0                	test   %al,%al
  802332:	74 0c                	je     802340 <strcmp+0x20>
  802334:	3a 02                	cmp    (%edx),%al
  802336:	75 08                	jne    802340 <strcmp+0x20>
		p++, q++;
  802338:	83 c1 01             	add    $0x1,%ecx
  80233b:	83 c2 01             	add    $0x1,%edx
  80233e:	eb ed                	jmp    80232d <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  802340:	0f b6 c0             	movzbl %al,%eax
  802343:	0f b6 12             	movzbl (%edx),%edx
  802346:	29 d0                	sub    %edx,%eax
}
  802348:	5d                   	pop    %ebp
  802349:	c3                   	ret    

0080234a <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  80234a:	f3 0f 1e fb          	endbr32 
  80234e:	55                   	push   %ebp
  80234f:	89 e5                	mov    %esp,%ebp
  802351:	53                   	push   %ebx
  802352:	8b 45 08             	mov    0x8(%ebp),%eax
  802355:	8b 55 0c             	mov    0xc(%ebp),%edx
  802358:	89 c3                	mov    %eax,%ebx
  80235a:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  80235d:	eb 06                	jmp    802365 <strncmp+0x1b>
		n--, p++, q++;
  80235f:	83 c0 01             	add    $0x1,%eax
  802362:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  802365:	39 d8                	cmp    %ebx,%eax
  802367:	74 16                	je     80237f <strncmp+0x35>
  802369:	0f b6 08             	movzbl (%eax),%ecx
  80236c:	84 c9                	test   %cl,%cl
  80236e:	74 04                	je     802374 <strncmp+0x2a>
  802370:	3a 0a                	cmp    (%edx),%cl
  802372:	74 eb                	je     80235f <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  802374:	0f b6 00             	movzbl (%eax),%eax
  802377:	0f b6 12             	movzbl (%edx),%edx
  80237a:	29 d0                	sub    %edx,%eax
}
  80237c:	5b                   	pop    %ebx
  80237d:	5d                   	pop    %ebp
  80237e:	c3                   	ret    
		return 0;
  80237f:	b8 00 00 00 00       	mov    $0x0,%eax
  802384:	eb f6                	jmp    80237c <strncmp+0x32>

00802386 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  802386:	f3 0f 1e fb          	endbr32 
  80238a:	55                   	push   %ebp
  80238b:	89 e5                	mov    %esp,%ebp
  80238d:	8b 45 08             	mov    0x8(%ebp),%eax
  802390:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  802394:	0f b6 10             	movzbl (%eax),%edx
  802397:	84 d2                	test   %dl,%dl
  802399:	74 09                	je     8023a4 <strchr+0x1e>
		if (*s == c)
  80239b:	38 ca                	cmp    %cl,%dl
  80239d:	74 0a                	je     8023a9 <strchr+0x23>
	for (; *s; s++)
  80239f:	83 c0 01             	add    $0x1,%eax
  8023a2:	eb f0                	jmp    802394 <strchr+0xe>
			return (char *) s;
	return 0;
  8023a4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8023a9:	5d                   	pop    %ebp
  8023aa:	c3                   	ret    

008023ab <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8023ab:	f3 0f 1e fb          	endbr32 
  8023af:	55                   	push   %ebp
  8023b0:	89 e5                	mov    %esp,%ebp
  8023b2:	8b 45 08             	mov    0x8(%ebp),%eax
  8023b5:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8023b9:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  8023bc:	38 ca                	cmp    %cl,%dl
  8023be:	74 09                	je     8023c9 <strfind+0x1e>
  8023c0:	84 d2                	test   %dl,%dl
  8023c2:	74 05                	je     8023c9 <strfind+0x1e>
	for (; *s; s++)
  8023c4:	83 c0 01             	add    $0x1,%eax
  8023c7:	eb f0                	jmp    8023b9 <strfind+0xe>
			break;
	return (char *) s;
}
  8023c9:	5d                   	pop    %ebp
  8023ca:	c3                   	ret    

008023cb <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  8023cb:	f3 0f 1e fb          	endbr32 
  8023cf:	55                   	push   %ebp
  8023d0:	89 e5                	mov    %esp,%ebp
  8023d2:	57                   	push   %edi
  8023d3:	56                   	push   %esi
  8023d4:	53                   	push   %ebx
  8023d5:	8b 7d 08             	mov    0x8(%ebp),%edi
  8023d8:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  8023db:	85 c9                	test   %ecx,%ecx
  8023dd:	74 31                	je     802410 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  8023df:	89 f8                	mov    %edi,%eax
  8023e1:	09 c8                	or     %ecx,%eax
  8023e3:	a8 03                	test   $0x3,%al
  8023e5:	75 23                	jne    80240a <memset+0x3f>
		c &= 0xFF;
  8023e7:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  8023eb:	89 d3                	mov    %edx,%ebx
  8023ed:	c1 e3 08             	shl    $0x8,%ebx
  8023f0:	89 d0                	mov    %edx,%eax
  8023f2:	c1 e0 18             	shl    $0x18,%eax
  8023f5:	89 d6                	mov    %edx,%esi
  8023f7:	c1 e6 10             	shl    $0x10,%esi
  8023fa:	09 f0                	or     %esi,%eax
  8023fc:	09 c2                	or     %eax,%edx
  8023fe:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  802400:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  802403:	89 d0                	mov    %edx,%eax
  802405:	fc                   	cld    
  802406:	f3 ab                	rep stos %eax,%es:(%edi)
  802408:	eb 06                	jmp    802410 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  80240a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80240d:	fc                   	cld    
  80240e:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  802410:	89 f8                	mov    %edi,%eax
  802412:	5b                   	pop    %ebx
  802413:	5e                   	pop    %esi
  802414:	5f                   	pop    %edi
  802415:	5d                   	pop    %ebp
  802416:	c3                   	ret    

00802417 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  802417:	f3 0f 1e fb          	endbr32 
  80241b:	55                   	push   %ebp
  80241c:	89 e5                	mov    %esp,%ebp
  80241e:	57                   	push   %edi
  80241f:	56                   	push   %esi
  802420:	8b 45 08             	mov    0x8(%ebp),%eax
  802423:	8b 75 0c             	mov    0xc(%ebp),%esi
  802426:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  802429:	39 c6                	cmp    %eax,%esi
  80242b:	73 32                	jae    80245f <memmove+0x48>
  80242d:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  802430:	39 c2                	cmp    %eax,%edx
  802432:	76 2b                	jbe    80245f <memmove+0x48>
		s += n;
		d += n;
  802434:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  802437:	89 fe                	mov    %edi,%esi
  802439:	09 ce                	or     %ecx,%esi
  80243b:	09 d6                	or     %edx,%esi
  80243d:	f7 c6 03 00 00 00    	test   $0x3,%esi
  802443:	75 0e                	jne    802453 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  802445:	83 ef 04             	sub    $0x4,%edi
  802448:	8d 72 fc             	lea    -0x4(%edx),%esi
  80244b:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  80244e:	fd                   	std    
  80244f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  802451:	eb 09                	jmp    80245c <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  802453:	83 ef 01             	sub    $0x1,%edi
  802456:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  802459:	fd                   	std    
  80245a:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  80245c:	fc                   	cld    
  80245d:	eb 1a                	jmp    802479 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  80245f:	89 c2                	mov    %eax,%edx
  802461:	09 ca                	or     %ecx,%edx
  802463:	09 f2                	or     %esi,%edx
  802465:	f6 c2 03             	test   $0x3,%dl
  802468:	75 0a                	jne    802474 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  80246a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  80246d:	89 c7                	mov    %eax,%edi
  80246f:	fc                   	cld    
  802470:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  802472:	eb 05                	jmp    802479 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  802474:	89 c7                	mov    %eax,%edi
  802476:	fc                   	cld    
  802477:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  802479:	5e                   	pop    %esi
  80247a:	5f                   	pop    %edi
  80247b:	5d                   	pop    %ebp
  80247c:	c3                   	ret    

0080247d <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  80247d:	f3 0f 1e fb          	endbr32 
  802481:	55                   	push   %ebp
  802482:	89 e5                	mov    %esp,%ebp
  802484:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  802487:	ff 75 10             	pushl  0x10(%ebp)
  80248a:	ff 75 0c             	pushl  0xc(%ebp)
  80248d:	ff 75 08             	pushl  0x8(%ebp)
  802490:	e8 82 ff ff ff       	call   802417 <memmove>
}
  802495:	c9                   	leave  
  802496:	c3                   	ret    

00802497 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  802497:	f3 0f 1e fb          	endbr32 
  80249b:	55                   	push   %ebp
  80249c:	89 e5                	mov    %esp,%ebp
  80249e:	56                   	push   %esi
  80249f:	53                   	push   %ebx
  8024a0:	8b 45 08             	mov    0x8(%ebp),%eax
  8024a3:	8b 55 0c             	mov    0xc(%ebp),%edx
  8024a6:	89 c6                	mov    %eax,%esi
  8024a8:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  8024ab:	39 f0                	cmp    %esi,%eax
  8024ad:	74 1c                	je     8024cb <memcmp+0x34>
		if (*s1 != *s2)
  8024af:	0f b6 08             	movzbl (%eax),%ecx
  8024b2:	0f b6 1a             	movzbl (%edx),%ebx
  8024b5:	38 d9                	cmp    %bl,%cl
  8024b7:	75 08                	jne    8024c1 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  8024b9:	83 c0 01             	add    $0x1,%eax
  8024bc:	83 c2 01             	add    $0x1,%edx
  8024bf:	eb ea                	jmp    8024ab <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  8024c1:	0f b6 c1             	movzbl %cl,%eax
  8024c4:	0f b6 db             	movzbl %bl,%ebx
  8024c7:	29 d8                	sub    %ebx,%eax
  8024c9:	eb 05                	jmp    8024d0 <memcmp+0x39>
	}

	return 0;
  8024cb:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8024d0:	5b                   	pop    %ebx
  8024d1:	5e                   	pop    %esi
  8024d2:	5d                   	pop    %ebp
  8024d3:	c3                   	ret    

008024d4 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  8024d4:	f3 0f 1e fb          	endbr32 
  8024d8:	55                   	push   %ebp
  8024d9:	89 e5                	mov    %esp,%ebp
  8024db:	8b 45 08             	mov    0x8(%ebp),%eax
  8024de:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  8024e1:	89 c2                	mov    %eax,%edx
  8024e3:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  8024e6:	39 d0                	cmp    %edx,%eax
  8024e8:	73 09                	jae    8024f3 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  8024ea:	38 08                	cmp    %cl,(%eax)
  8024ec:	74 05                	je     8024f3 <memfind+0x1f>
	for (; s < ends; s++)
  8024ee:	83 c0 01             	add    $0x1,%eax
  8024f1:	eb f3                	jmp    8024e6 <memfind+0x12>
			break;
	return (void *) s;
}
  8024f3:	5d                   	pop    %ebp
  8024f4:	c3                   	ret    

008024f5 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  8024f5:	f3 0f 1e fb          	endbr32 
  8024f9:	55                   	push   %ebp
  8024fa:	89 e5                	mov    %esp,%ebp
  8024fc:	57                   	push   %edi
  8024fd:	56                   	push   %esi
  8024fe:	53                   	push   %ebx
  8024ff:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802502:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  802505:	eb 03                	jmp    80250a <strtol+0x15>
		s++;
  802507:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  80250a:	0f b6 01             	movzbl (%ecx),%eax
  80250d:	3c 20                	cmp    $0x20,%al
  80250f:	74 f6                	je     802507 <strtol+0x12>
  802511:	3c 09                	cmp    $0x9,%al
  802513:	74 f2                	je     802507 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  802515:	3c 2b                	cmp    $0x2b,%al
  802517:	74 2a                	je     802543 <strtol+0x4e>
	int neg = 0;
  802519:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  80251e:	3c 2d                	cmp    $0x2d,%al
  802520:	74 2b                	je     80254d <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  802522:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  802528:	75 0f                	jne    802539 <strtol+0x44>
  80252a:	80 39 30             	cmpb   $0x30,(%ecx)
  80252d:	74 28                	je     802557 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  80252f:	85 db                	test   %ebx,%ebx
  802531:	b8 0a 00 00 00       	mov    $0xa,%eax
  802536:	0f 44 d8             	cmove  %eax,%ebx
  802539:	b8 00 00 00 00       	mov    $0x0,%eax
  80253e:	89 5d 10             	mov    %ebx,0x10(%ebp)
  802541:	eb 46                	jmp    802589 <strtol+0x94>
		s++;
  802543:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  802546:	bf 00 00 00 00       	mov    $0x0,%edi
  80254b:	eb d5                	jmp    802522 <strtol+0x2d>
		s++, neg = 1;
  80254d:	83 c1 01             	add    $0x1,%ecx
  802550:	bf 01 00 00 00       	mov    $0x1,%edi
  802555:	eb cb                	jmp    802522 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  802557:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  80255b:	74 0e                	je     80256b <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  80255d:	85 db                	test   %ebx,%ebx
  80255f:	75 d8                	jne    802539 <strtol+0x44>
		s++, base = 8;
  802561:	83 c1 01             	add    $0x1,%ecx
  802564:	bb 08 00 00 00       	mov    $0x8,%ebx
  802569:	eb ce                	jmp    802539 <strtol+0x44>
		s += 2, base = 16;
  80256b:	83 c1 02             	add    $0x2,%ecx
  80256e:	bb 10 00 00 00       	mov    $0x10,%ebx
  802573:	eb c4                	jmp    802539 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  802575:	0f be d2             	movsbl %dl,%edx
  802578:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  80257b:	3b 55 10             	cmp    0x10(%ebp),%edx
  80257e:	7d 3a                	jge    8025ba <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  802580:	83 c1 01             	add    $0x1,%ecx
  802583:	0f af 45 10          	imul   0x10(%ebp),%eax
  802587:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  802589:	0f b6 11             	movzbl (%ecx),%edx
  80258c:	8d 72 d0             	lea    -0x30(%edx),%esi
  80258f:	89 f3                	mov    %esi,%ebx
  802591:	80 fb 09             	cmp    $0x9,%bl
  802594:	76 df                	jbe    802575 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  802596:	8d 72 9f             	lea    -0x61(%edx),%esi
  802599:	89 f3                	mov    %esi,%ebx
  80259b:	80 fb 19             	cmp    $0x19,%bl
  80259e:	77 08                	ja     8025a8 <strtol+0xb3>
			dig = *s - 'a' + 10;
  8025a0:	0f be d2             	movsbl %dl,%edx
  8025a3:	83 ea 57             	sub    $0x57,%edx
  8025a6:	eb d3                	jmp    80257b <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  8025a8:	8d 72 bf             	lea    -0x41(%edx),%esi
  8025ab:	89 f3                	mov    %esi,%ebx
  8025ad:	80 fb 19             	cmp    $0x19,%bl
  8025b0:	77 08                	ja     8025ba <strtol+0xc5>
			dig = *s - 'A' + 10;
  8025b2:	0f be d2             	movsbl %dl,%edx
  8025b5:	83 ea 37             	sub    $0x37,%edx
  8025b8:	eb c1                	jmp    80257b <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  8025ba:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  8025be:	74 05                	je     8025c5 <strtol+0xd0>
		*endptr = (char *) s;
  8025c0:	8b 75 0c             	mov    0xc(%ebp),%esi
  8025c3:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  8025c5:	89 c2                	mov    %eax,%edx
  8025c7:	f7 da                	neg    %edx
  8025c9:	85 ff                	test   %edi,%edi
  8025cb:	0f 45 c2             	cmovne %edx,%eax
}
  8025ce:	5b                   	pop    %ebx
  8025cf:	5e                   	pop    %esi
  8025d0:	5f                   	pop    %edi
  8025d1:	5d                   	pop    %ebp
  8025d2:	c3                   	ret    

008025d3 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  8025d3:	f3 0f 1e fb          	endbr32 
  8025d7:	55                   	push   %ebp
  8025d8:	89 e5                	mov    %esp,%ebp
  8025da:	57                   	push   %edi
  8025db:	56                   	push   %esi
  8025dc:	53                   	push   %ebx
	asm volatile("int %1\n"
  8025dd:	b8 00 00 00 00       	mov    $0x0,%eax
  8025e2:	8b 55 08             	mov    0x8(%ebp),%edx
  8025e5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8025e8:	89 c3                	mov    %eax,%ebx
  8025ea:	89 c7                	mov    %eax,%edi
  8025ec:	89 c6                	mov    %eax,%esi
  8025ee:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  8025f0:	5b                   	pop    %ebx
  8025f1:	5e                   	pop    %esi
  8025f2:	5f                   	pop    %edi
  8025f3:	5d                   	pop    %ebp
  8025f4:	c3                   	ret    

008025f5 <sys_cgetc>:

int
sys_cgetc(void)
{
  8025f5:	f3 0f 1e fb          	endbr32 
  8025f9:	55                   	push   %ebp
  8025fa:	89 e5                	mov    %esp,%ebp
  8025fc:	57                   	push   %edi
  8025fd:	56                   	push   %esi
  8025fe:	53                   	push   %ebx
	asm volatile("int %1\n"
  8025ff:	ba 00 00 00 00       	mov    $0x0,%edx
  802604:	b8 01 00 00 00       	mov    $0x1,%eax
  802609:	89 d1                	mov    %edx,%ecx
  80260b:	89 d3                	mov    %edx,%ebx
  80260d:	89 d7                	mov    %edx,%edi
  80260f:	89 d6                	mov    %edx,%esi
  802611:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  802613:	5b                   	pop    %ebx
  802614:	5e                   	pop    %esi
  802615:	5f                   	pop    %edi
  802616:	5d                   	pop    %ebp
  802617:	c3                   	ret    

00802618 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  802618:	f3 0f 1e fb          	endbr32 
  80261c:	55                   	push   %ebp
  80261d:	89 e5                	mov    %esp,%ebp
  80261f:	57                   	push   %edi
  802620:	56                   	push   %esi
  802621:	53                   	push   %ebx
  802622:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  802625:	b9 00 00 00 00       	mov    $0x0,%ecx
  80262a:	8b 55 08             	mov    0x8(%ebp),%edx
  80262d:	b8 03 00 00 00       	mov    $0x3,%eax
  802632:	89 cb                	mov    %ecx,%ebx
  802634:	89 cf                	mov    %ecx,%edi
  802636:	89 ce                	mov    %ecx,%esi
  802638:	cd 30                	int    $0x30
	if(check && ret > 0)
  80263a:	85 c0                	test   %eax,%eax
  80263c:	7f 08                	jg     802646 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  80263e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802641:	5b                   	pop    %ebx
  802642:	5e                   	pop    %esi
  802643:	5f                   	pop    %edi
  802644:	5d                   	pop    %ebp
  802645:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  802646:	83 ec 0c             	sub    $0xc,%esp
  802649:	50                   	push   %eax
  80264a:	6a 03                	push   $0x3
  80264c:	68 1f 43 80 00       	push   $0x80431f
  802651:	6a 23                	push   $0x23
  802653:	68 3c 43 80 00       	push   $0x80433c
  802658:	e8 44 f5 ff ff       	call   801ba1 <_panic>

0080265d <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  80265d:	f3 0f 1e fb          	endbr32 
  802661:	55                   	push   %ebp
  802662:	89 e5                	mov    %esp,%ebp
  802664:	57                   	push   %edi
  802665:	56                   	push   %esi
  802666:	53                   	push   %ebx
	asm volatile("int %1\n"
  802667:	ba 00 00 00 00       	mov    $0x0,%edx
  80266c:	b8 02 00 00 00       	mov    $0x2,%eax
  802671:	89 d1                	mov    %edx,%ecx
  802673:	89 d3                	mov    %edx,%ebx
  802675:	89 d7                	mov    %edx,%edi
  802677:	89 d6                	mov    %edx,%esi
  802679:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  80267b:	5b                   	pop    %ebx
  80267c:	5e                   	pop    %esi
  80267d:	5f                   	pop    %edi
  80267e:	5d                   	pop    %ebp
  80267f:	c3                   	ret    

00802680 <sys_yield>:

void
sys_yield(void)
{
  802680:	f3 0f 1e fb          	endbr32 
  802684:	55                   	push   %ebp
  802685:	89 e5                	mov    %esp,%ebp
  802687:	57                   	push   %edi
  802688:	56                   	push   %esi
  802689:	53                   	push   %ebx
	asm volatile("int %1\n"
  80268a:	ba 00 00 00 00       	mov    $0x0,%edx
  80268f:	b8 0b 00 00 00       	mov    $0xb,%eax
  802694:	89 d1                	mov    %edx,%ecx
  802696:	89 d3                	mov    %edx,%ebx
  802698:	89 d7                	mov    %edx,%edi
  80269a:	89 d6                	mov    %edx,%esi
  80269c:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  80269e:	5b                   	pop    %ebx
  80269f:	5e                   	pop    %esi
  8026a0:	5f                   	pop    %edi
  8026a1:	5d                   	pop    %ebp
  8026a2:	c3                   	ret    

008026a3 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  8026a3:	f3 0f 1e fb          	endbr32 
  8026a7:	55                   	push   %ebp
  8026a8:	89 e5                	mov    %esp,%ebp
  8026aa:	57                   	push   %edi
  8026ab:	56                   	push   %esi
  8026ac:	53                   	push   %ebx
  8026ad:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8026b0:	be 00 00 00 00       	mov    $0x0,%esi
  8026b5:	8b 55 08             	mov    0x8(%ebp),%edx
  8026b8:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8026bb:	b8 04 00 00 00       	mov    $0x4,%eax
  8026c0:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8026c3:	89 f7                	mov    %esi,%edi
  8026c5:	cd 30                	int    $0x30
	if(check && ret > 0)
  8026c7:	85 c0                	test   %eax,%eax
  8026c9:	7f 08                	jg     8026d3 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  8026cb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8026ce:	5b                   	pop    %ebx
  8026cf:	5e                   	pop    %esi
  8026d0:	5f                   	pop    %edi
  8026d1:	5d                   	pop    %ebp
  8026d2:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8026d3:	83 ec 0c             	sub    $0xc,%esp
  8026d6:	50                   	push   %eax
  8026d7:	6a 04                	push   $0x4
  8026d9:	68 1f 43 80 00       	push   $0x80431f
  8026de:	6a 23                	push   $0x23
  8026e0:	68 3c 43 80 00       	push   $0x80433c
  8026e5:	e8 b7 f4 ff ff       	call   801ba1 <_panic>

008026ea <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  8026ea:	f3 0f 1e fb          	endbr32 
  8026ee:	55                   	push   %ebp
  8026ef:	89 e5                	mov    %esp,%ebp
  8026f1:	57                   	push   %edi
  8026f2:	56                   	push   %esi
  8026f3:	53                   	push   %ebx
  8026f4:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8026f7:	8b 55 08             	mov    0x8(%ebp),%edx
  8026fa:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8026fd:	b8 05 00 00 00       	mov    $0x5,%eax
  802702:	8b 5d 10             	mov    0x10(%ebp),%ebx
  802705:	8b 7d 14             	mov    0x14(%ebp),%edi
  802708:	8b 75 18             	mov    0x18(%ebp),%esi
  80270b:	cd 30                	int    $0x30
	if(check && ret > 0)
  80270d:	85 c0                	test   %eax,%eax
  80270f:	7f 08                	jg     802719 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  802711:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802714:	5b                   	pop    %ebx
  802715:	5e                   	pop    %esi
  802716:	5f                   	pop    %edi
  802717:	5d                   	pop    %ebp
  802718:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  802719:	83 ec 0c             	sub    $0xc,%esp
  80271c:	50                   	push   %eax
  80271d:	6a 05                	push   $0x5
  80271f:	68 1f 43 80 00       	push   $0x80431f
  802724:	6a 23                	push   $0x23
  802726:	68 3c 43 80 00       	push   $0x80433c
  80272b:	e8 71 f4 ff ff       	call   801ba1 <_panic>

00802730 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  802730:	f3 0f 1e fb          	endbr32 
  802734:	55                   	push   %ebp
  802735:	89 e5                	mov    %esp,%ebp
  802737:	57                   	push   %edi
  802738:	56                   	push   %esi
  802739:	53                   	push   %ebx
  80273a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80273d:	bb 00 00 00 00       	mov    $0x0,%ebx
  802742:	8b 55 08             	mov    0x8(%ebp),%edx
  802745:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  802748:	b8 06 00 00 00       	mov    $0x6,%eax
  80274d:	89 df                	mov    %ebx,%edi
  80274f:	89 de                	mov    %ebx,%esi
  802751:	cd 30                	int    $0x30
	if(check && ret > 0)
  802753:	85 c0                	test   %eax,%eax
  802755:	7f 08                	jg     80275f <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  802757:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80275a:	5b                   	pop    %ebx
  80275b:	5e                   	pop    %esi
  80275c:	5f                   	pop    %edi
  80275d:	5d                   	pop    %ebp
  80275e:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80275f:	83 ec 0c             	sub    $0xc,%esp
  802762:	50                   	push   %eax
  802763:	6a 06                	push   $0x6
  802765:	68 1f 43 80 00       	push   $0x80431f
  80276a:	6a 23                	push   $0x23
  80276c:	68 3c 43 80 00       	push   $0x80433c
  802771:	e8 2b f4 ff ff       	call   801ba1 <_panic>

00802776 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  802776:	f3 0f 1e fb          	endbr32 
  80277a:	55                   	push   %ebp
  80277b:	89 e5                	mov    %esp,%ebp
  80277d:	57                   	push   %edi
  80277e:	56                   	push   %esi
  80277f:	53                   	push   %ebx
  802780:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  802783:	bb 00 00 00 00       	mov    $0x0,%ebx
  802788:	8b 55 08             	mov    0x8(%ebp),%edx
  80278b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80278e:	b8 08 00 00 00       	mov    $0x8,%eax
  802793:	89 df                	mov    %ebx,%edi
  802795:	89 de                	mov    %ebx,%esi
  802797:	cd 30                	int    $0x30
	if(check && ret > 0)
  802799:	85 c0                	test   %eax,%eax
  80279b:	7f 08                	jg     8027a5 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  80279d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8027a0:	5b                   	pop    %ebx
  8027a1:	5e                   	pop    %esi
  8027a2:	5f                   	pop    %edi
  8027a3:	5d                   	pop    %ebp
  8027a4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8027a5:	83 ec 0c             	sub    $0xc,%esp
  8027a8:	50                   	push   %eax
  8027a9:	6a 08                	push   $0x8
  8027ab:	68 1f 43 80 00       	push   $0x80431f
  8027b0:	6a 23                	push   $0x23
  8027b2:	68 3c 43 80 00       	push   $0x80433c
  8027b7:	e8 e5 f3 ff ff       	call   801ba1 <_panic>

008027bc <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  8027bc:	f3 0f 1e fb          	endbr32 
  8027c0:	55                   	push   %ebp
  8027c1:	89 e5                	mov    %esp,%ebp
  8027c3:	57                   	push   %edi
  8027c4:	56                   	push   %esi
  8027c5:	53                   	push   %ebx
  8027c6:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8027c9:	bb 00 00 00 00       	mov    $0x0,%ebx
  8027ce:	8b 55 08             	mov    0x8(%ebp),%edx
  8027d1:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8027d4:	b8 09 00 00 00       	mov    $0x9,%eax
  8027d9:	89 df                	mov    %ebx,%edi
  8027db:	89 de                	mov    %ebx,%esi
  8027dd:	cd 30                	int    $0x30
	if(check && ret > 0)
  8027df:	85 c0                	test   %eax,%eax
  8027e1:	7f 08                	jg     8027eb <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  8027e3:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8027e6:	5b                   	pop    %ebx
  8027e7:	5e                   	pop    %esi
  8027e8:	5f                   	pop    %edi
  8027e9:	5d                   	pop    %ebp
  8027ea:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8027eb:	83 ec 0c             	sub    $0xc,%esp
  8027ee:	50                   	push   %eax
  8027ef:	6a 09                	push   $0x9
  8027f1:	68 1f 43 80 00       	push   $0x80431f
  8027f6:	6a 23                	push   $0x23
  8027f8:	68 3c 43 80 00       	push   $0x80433c
  8027fd:	e8 9f f3 ff ff       	call   801ba1 <_panic>

00802802 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  802802:	f3 0f 1e fb          	endbr32 
  802806:	55                   	push   %ebp
  802807:	89 e5                	mov    %esp,%ebp
  802809:	57                   	push   %edi
  80280a:	56                   	push   %esi
  80280b:	53                   	push   %ebx
  80280c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80280f:	bb 00 00 00 00       	mov    $0x0,%ebx
  802814:	8b 55 08             	mov    0x8(%ebp),%edx
  802817:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80281a:	b8 0a 00 00 00       	mov    $0xa,%eax
  80281f:	89 df                	mov    %ebx,%edi
  802821:	89 de                	mov    %ebx,%esi
  802823:	cd 30                	int    $0x30
	if(check && ret > 0)
  802825:	85 c0                	test   %eax,%eax
  802827:	7f 08                	jg     802831 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  802829:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80282c:	5b                   	pop    %ebx
  80282d:	5e                   	pop    %esi
  80282e:	5f                   	pop    %edi
  80282f:	5d                   	pop    %ebp
  802830:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  802831:	83 ec 0c             	sub    $0xc,%esp
  802834:	50                   	push   %eax
  802835:	6a 0a                	push   $0xa
  802837:	68 1f 43 80 00       	push   $0x80431f
  80283c:	6a 23                	push   $0x23
  80283e:	68 3c 43 80 00       	push   $0x80433c
  802843:	e8 59 f3 ff ff       	call   801ba1 <_panic>

00802848 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  802848:	f3 0f 1e fb          	endbr32 
  80284c:	55                   	push   %ebp
  80284d:	89 e5                	mov    %esp,%ebp
  80284f:	57                   	push   %edi
  802850:	56                   	push   %esi
  802851:	53                   	push   %ebx
	asm volatile("int %1\n"
  802852:	8b 55 08             	mov    0x8(%ebp),%edx
  802855:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  802858:	b8 0c 00 00 00       	mov    $0xc,%eax
  80285d:	be 00 00 00 00       	mov    $0x0,%esi
  802862:	8b 5d 10             	mov    0x10(%ebp),%ebx
  802865:	8b 7d 14             	mov    0x14(%ebp),%edi
  802868:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  80286a:	5b                   	pop    %ebx
  80286b:	5e                   	pop    %esi
  80286c:	5f                   	pop    %edi
  80286d:	5d                   	pop    %ebp
  80286e:	c3                   	ret    

0080286f <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  80286f:	f3 0f 1e fb          	endbr32 
  802873:	55                   	push   %ebp
  802874:	89 e5                	mov    %esp,%ebp
  802876:	57                   	push   %edi
  802877:	56                   	push   %esi
  802878:	53                   	push   %ebx
  802879:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80287c:	b9 00 00 00 00       	mov    $0x0,%ecx
  802881:	8b 55 08             	mov    0x8(%ebp),%edx
  802884:	b8 0d 00 00 00       	mov    $0xd,%eax
  802889:	89 cb                	mov    %ecx,%ebx
  80288b:	89 cf                	mov    %ecx,%edi
  80288d:	89 ce                	mov    %ecx,%esi
  80288f:	cd 30                	int    $0x30
	if(check && ret > 0)
  802891:	85 c0                	test   %eax,%eax
  802893:	7f 08                	jg     80289d <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  802895:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802898:	5b                   	pop    %ebx
  802899:	5e                   	pop    %esi
  80289a:	5f                   	pop    %edi
  80289b:	5d                   	pop    %ebp
  80289c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80289d:	83 ec 0c             	sub    $0xc,%esp
  8028a0:	50                   	push   %eax
  8028a1:	6a 0d                	push   $0xd
  8028a3:	68 1f 43 80 00       	push   $0x80431f
  8028a8:	6a 23                	push   $0x23
  8028aa:	68 3c 43 80 00       	push   $0x80433c
  8028af:	e8 ed f2 ff ff       	call   801ba1 <_panic>

008028b4 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  8028b4:	f3 0f 1e fb          	endbr32 
  8028b8:	55                   	push   %ebp
  8028b9:	89 e5                	mov    %esp,%ebp
  8028bb:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  8028be:	83 3d 10 a0 80 00 00 	cmpl   $0x0,0x80a010
  8028c5:	74 27                	je     8028ee <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  8028c7:	8b 45 08             	mov    0x8(%ebp),%eax
  8028ca:	a3 10 a0 80 00       	mov    %eax,0x80a010
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  8028cf:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  8028d4:	8b 40 48             	mov    0x48(%eax),%eax
  8028d7:	83 ec 08             	sub    $0x8,%esp
  8028da:	68 2e 29 80 00       	push   $0x80292e
  8028df:	50                   	push   %eax
  8028e0:	e8 1d ff ff ff       	call   802802 <sys_env_set_pgfault_upcall>
  8028e5:	83 c4 10             	add    $0x10,%esp
  8028e8:	85 c0                	test   %eax,%eax
  8028ea:	78 2e                	js     80291a <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  8028ec:	c9                   	leave  
  8028ed:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  8028ee:	83 ec 04             	sub    $0x4,%esp
  8028f1:	6a 07                	push   $0x7
  8028f3:	68 00 f0 bf ee       	push   $0xeebff000
  8028f8:	6a 00                	push   $0x0
  8028fa:	e8 a4 fd ff ff       	call   8026a3 <sys_page_alloc>
  8028ff:	83 c4 10             	add    $0x10,%esp
  802902:	85 c0                	test   %eax,%eax
  802904:	79 c1                	jns    8028c7 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  802906:	83 ec 04             	sub    $0x4,%esp
  802909:	68 4c 43 80 00       	push   $0x80434c
  80290e:	6a 21                	push   $0x21
  802910:	68 ae 43 80 00       	push   $0x8043ae
  802915:	e8 87 f2 ff ff       	call   801ba1 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  80291a:	83 ec 04             	sub    $0x4,%esp
  80291d:	68 78 43 80 00       	push   $0x804378
  802922:	6a 27                	push   $0x27
  802924:	68 ae 43 80 00       	push   $0x8043ae
  802929:	e8 73 f2 ff ff       	call   801ba1 <_panic>

0080292e <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  80292e:	54                   	push   %esp
	movl _pgfault_handler, %eax
  80292f:	a1 10 a0 80 00       	mov    0x80a010,%eax
	call *%eax
  802934:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  802936:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  802939:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  80293d:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  802940:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  802944:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  802948:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  80294b:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  80294e:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  80294f:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  802952:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  802953:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  802954:	c3                   	ret    

00802955 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  802955:	f3 0f 1e fb          	endbr32 
  802959:	55                   	push   %ebp
  80295a:	89 e5                	mov    %esp,%ebp
  80295c:	56                   	push   %esi
  80295d:	53                   	push   %ebx
  80295e:	8b 75 08             	mov    0x8(%ebp),%esi
  802961:	8b 45 0c             	mov    0xc(%ebp),%eax
  802964:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  802967:	85 c0                	test   %eax,%eax
  802969:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80296e:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  802971:	83 ec 0c             	sub    $0xc,%esp
  802974:	50                   	push   %eax
  802975:	e8 f5 fe ff ff       	call   80286f <sys_ipc_recv>
  80297a:	83 c4 10             	add    $0x10,%esp
  80297d:	85 c0                	test   %eax,%eax
  80297f:	78 3f                	js     8029c0 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  802981:	e8 d7 fc ff ff       	call   80265d <sys_getenvid>
  802986:	25 ff 03 00 00       	and    $0x3ff,%eax
  80298b:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80298e:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802994:	89 15 0c a0 80 00    	mov    %edx,0x80a00c

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  80299a:	85 f6                	test   %esi,%esi
  80299c:	74 05                	je     8029a3 <ipc_recv+0x4e>
  80299e:	8b 42 74             	mov    0x74(%edx),%eax
  8029a1:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  8029a3:	85 db                	test   %ebx,%ebx
  8029a5:	74 0a                	je     8029b1 <ipc_recv+0x5c>
  8029a7:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  8029ac:	8b 40 78             	mov    0x78(%eax),%eax
  8029af:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  8029b1:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  8029b6:	8b 40 70             	mov    0x70(%eax),%eax
}
  8029b9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8029bc:	5b                   	pop    %ebx
  8029bd:	5e                   	pop    %esi
  8029be:	5d                   	pop    %ebp
  8029bf:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8029c0:	85 f6                	test   %esi,%esi
  8029c2:	74 06                	je     8029ca <ipc_recv+0x75>
  8029c4:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8029ca:	85 db                	test   %ebx,%ebx
  8029cc:	74 eb                	je     8029b9 <ipc_recv+0x64>
  8029ce:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8029d4:	eb e3                	jmp    8029b9 <ipc_recv+0x64>

008029d6 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  8029d6:	f3 0f 1e fb          	endbr32 
  8029da:	55                   	push   %ebp
  8029db:	89 e5                	mov    %esp,%ebp
  8029dd:	57                   	push   %edi
  8029de:	56                   	push   %esi
  8029df:	53                   	push   %ebx
  8029e0:	83 ec 0c             	sub    $0xc,%esp
  8029e3:	8b 7d 08             	mov    0x8(%ebp),%edi
  8029e6:	8b 75 0c             	mov    0xc(%ebp),%esi
  8029e9:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8029ec:	85 db                	test   %ebx,%ebx
  8029ee:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8029f3:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8029f6:	ff 75 14             	pushl  0x14(%ebp)
  8029f9:	53                   	push   %ebx
  8029fa:	56                   	push   %esi
  8029fb:	57                   	push   %edi
  8029fc:	e8 47 fe ff ff       	call   802848 <sys_ipc_try_send>
  802a01:	83 c4 10             	add    $0x10,%esp
  802a04:	85 c0                	test   %eax,%eax
  802a06:	79 1e                	jns    802a26 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802a08:	83 f8 f9             	cmp    $0xfffffff9,%eax
  802a0b:	75 07                	jne    802a14 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  802a0d:	e8 6e fc ff ff       	call   802680 <sys_yield>
  802a12:	eb e2                	jmp    8029f6 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  802a14:	50                   	push   %eax
  802a15:	68 bc 43 80 00       	push   $0x8043bc
  802a1a:	6a 3b                	push   $0x3b
  802a1c:	68 d0 43 80 00       	push   $0x8043d0
  802a21:	e8 7b f1 ff ff       	call   801ba1 <_panic>
	}
}
  802a26:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802a29:	5b                   	pop    %ebx
  802a2a:	5e                   	pop    %esi
  802a2b:	5f                   	pop    %edi
  802a2c:	5d                   	pop    %ebp
  802a2d:	c3                   	ret    

00802a2e <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  802a2e:	f3 0f 1e fb          	endbr32 
  802a32:	55                   	push   %ebp
  802a33:	89 e5                	mov    %esp,%ebp
  802a35:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802a38:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  802a3d:	6b d0 7c             	imul   $0x7c,%eax,%edx
  802a40:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802a46:	8b 52 50             	mov    0x50(%edx),%edx
  802a49:	39 ca                	cmp    %ecx,%edx
  802a4b:	74 11                	je     802a5e <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  802a4d:	83 c0 01             	add    $0x1,%eax
  802a50:	3d 00 04 00 00       	cmp    $0x400,%eax
  802a55:	75 e6                	jne    802a3d <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802a57:	b8 00 00 00 00       	mov    $0x0,%eax
  802a5c:	eb 0b                	jmp    802a69 <ipc_find_env+0x3b>
			return envs[i].env_id;
  802a5e:	6b c0 7c             	imul   $0x7c,%eax,%eax
  802a61:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  802a66:	8b 40 48             	mov    0x48(%eax),%eax
}
  802a69:	5d                   	pop    %ebp
  802a6a:	c3                   	ret    

00802a6b <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  802a6b:	f3 0f 1e fb          	endbr32 
  802a6f:	55                   	push   %ebp
  802a70:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  802a72:	8b 45 08             	mov    0x8(%ebp),%eax
  802a75:	05 00 00 00 30       	add    $0x30000000,%eax
  802a7a:	c1 e8 0c             	shr    $0xc,%eax
}
  802a7d:	5d                   	pop    %ebp
  802a7e:	c3                   	ret    

00802a7f <fd2data>:

char*
fd2data(struct Fd *fd)
{
  802a7f:	f3 0f 1e fb          	endbr32 
  802a83:	55                   	push   %ebp
  802a84:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  802a86:	8b 45 08             	mov    0x8(%ebp),%eax
  802a89:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  802a8e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  802a93:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  802a98:	5d                   	pop    %ebp
  802a99:	c3                   	ret    

00802a9a <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  802a9a:	f3 0f 1e fb          	endbr32 
  802a9e:	55                   	push   %ebp
  802a9f:	89 e5                	mov    %esp,%ebp
  802aa1:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  802aa6:	89 c2                	mov    %eax,%edx
  802aa8:	c1 ea 16             	shr    $0x16,%edx
  802aab:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  802ab2:	f6 c2 01             	test   $0x1,%dl
  802ab5:	74 2d                	je     802ae4 <fd_alloc+0x4a>
  802ab7:	89 c2                	mov    %eax,%edx
  802ab9:	c1 ea 0c             	shr    $0xc,%edx
  802abc:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  802ac3:	f6 c2 01             	test   $0x1,%dl
  802ac6:	74 1c                	je     802ae4 <fd_alloc+0x4a>
  802ac8:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  802acd:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  802ad2:	75 d2                	jne    802aa6 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  802ad4:	8b 45 08             	mov    0x8(%ebp),%eax
  802ad7:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  802add:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  802ae2:	eb 0a                	jmp    802aee <fd_alloc+0x54>
			*fd_store = fd;
  802ae4:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802ae7:	89 01                	mov    %eax,(%ecx)
			return 0;
  802ae9:	b8 00 00 00 00       	mov    $0x0,%eax
}
  802aee:	5d                   	pop    %ebp
  802aef:	c3                   	ret    

00802af0 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  802af0:	f3 0f 1e fb          	endbr32 
  802af4:	55                   	push   %ebp
  802af5:	89 e5                	mov    %esp,%ebp
  802af7:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  802afa:	83 f8 1f             	cmp    $0x1f,%eax
  802afd:	77 30                	ja     802b2f <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  802aff:	c1 e0 0c             	shl    $0xc,%eax
  802b02:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  802b07:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  802b0d:	f6 c2 01             	test   $0x1,%dl
  802b10:	74 24                	je     802b36 <fd_lookup+0x46>
  802b12:	89 c2                	mov    %eax,%edx
  802b14:	c1 ea 0c             	shr    $0xc,%edx
  802b17:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  802b1e:	f6 c2 01             	test   $0x1,%dl
  802b21:	74 1a                	je     802b3d <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  802b23:	8b 55 0c             	mov    0xc(%ebp),%edx
  802b26:	89 02                	mov    %eax,(%edx)
	return 0;
  802b28:	b8 00 00 00 00       	mov    $0x0,%eax
}
  802b2d:	5d                   	pop    %ebp
  802b2e:	c3                   	ret    
		return -E_INVAL;
  802b2f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802b34:	eb f7                	jmp    802b2d <fd_lookup+0x3d>
		return -E_INVAL;
  802b36:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802b3b:	eb f0                	jmp    802b2d <fd_lookup+0x3d>
  802b3d:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802b42:	eb e9                	jmp    802b2d <fd_lookup+0x3d>

00802b44 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  802b44:	f3 0f 1e fb          	endbr32 
  802b48:	55                   	push   %ebp
  802b49:	89 e5                	mov    %esp,%ebp
  802b4b:	83 ec 08             	sub    $0x8,%esp
  802b4e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802b51:	ba 58 44 80 00       	mov    $0x804458,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  802b56:	b8 64 90 80 00       	mov    $0x809064,%eax
		if (devtab[i]->dev_id == dev_id) {
  802b5b:	39 08                	cmp    %ecx,(%eax)
  802b5d:	74 33                	je     802b92 <dev_lookup+0x4e>
  802b5f:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  802b62:	8b 02                	mov    (%edx),%eax
  802b64:	85 c0                	test   %eax,%eax
  802b66:	75 f3                	jne    802b5b <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  802b68:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  802b6d:	8b 40 48             	mov    0x48(%eax),%eax
  802b70:	83 ec 04             	sub    $0x4,%esp
  802b73:	51                   	push   %ecx
  802b74:	50                   	push   %eax
  802b75:	68 dc 43 80 00       	push   $0x8043dc
  802b7a:	e8 09 f1 ff ff       	call   801c88 <cprintf>
	*dev = 0;
  802b7f:	8b 45 0c             	mov    0xc(%ebp),%eax
  802b82:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  802b88:	83 c4 10             	add    $0x10,%esp
  802b8b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  802b90:	c9                   	leave  
  802b91:	c3                   	ret    
			*dev = devtab[i];
  802b92:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  802b95:	89 01                	mov    %eax,(%ecx)
			return 0;
  802b97:	b8 00 00 00 00       	mov    $0x0,%eax
  802b9c:	eb f2                	jmp    802b90 <dev_lookup+0x4c>

00802b9e <fd_close>:
{
  802b9e:	f3 0f 1e fb          	endbr32 
  802ba2:	55                   	push   %ebp
  802ba3:	89 e5                	mov    %esp,%ebp
  802ba5:	57                   	push   %edi
  802ba6:	56                   	push   %esi
  802ba7:	53                   	push   %ebx
  802ba8:	83 ec 24             	sub    $0x24,%esp
  802bab:	8b 75 08             	mov    0x8(%ebp),%esi
  802bae:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  802bb1:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  802bb4:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  802bb5:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  802bbb:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  802bbe:	50                   	push   %eax
  802bbf:	e8 2c ff ff ff       	call   802af0 <fd_lookup>
  802bc4:	89 c3                	mov    %eax,%ebx
  802bc6:	83 c4 10             	add    $0x10,%esp
  802bc9:	85 c0                	test   %eax,%eax
  802bcb:	78 05                	js     802bd2 <fd_close+0x34>
	    || fd != fd2)
  802bcd:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  802bd0:	74 16                	je     802be8 <fd_close+0x4a>
		return (must_exist ? r : 0);
  802bd2:	89 f8                	mov    %edi,%eax
  802bd4:	84 c0                	test   %al,%al
  802bd6:	b8 00 00 00 00       	mov    $0x0,%eax
  802bdb:	0f 44 d8             	cmove  %eax,%ebx
}
  802bde:	89 d8                	mov    %ebx,%eax
  802be0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802be3:	5b                   	pop    %ebx
  802be4:	5e                   	pop    %esi
  802be5:	5f                   	pop    %edi
  802be6:	5d                   	pop    %ebp
  802be7:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  802be8:	83 ec 08             	sub    $0x8,%esp
  802beb:	8d 45 e0             	lea    -0x20(%ebp),%eax
  802bee:	50                   	push   %eax
  802bef:	ff 36                	pushl  (%esi)
  802bf1:	e8 4e ff ff ff       	call   802b44 <dev_lookup>
  802bf6:	89 c3                	mov    %eax,%ebx
  802bf8:	83 c4 10             	add    $0x10,%esp
  802bfb:	85 c0                	test   %eax,%eax
  802bfd:	78 1a                	js     802c19 <fd_close+0x7b>
		if (dev->dev_close)
  802bff:	8b 45 e0             	mov    -0x20(%ebp),%eax
  802c02:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  802c05:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  802c0a:	85 c0                	test   %eax,%eax
  802c0c:	74 0b                	je     802c19 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  802c0e:	83 ec 0c             	sub    $0xc,%esp
  802c11:	56                   	push   %esi
  802c12:	ff d0                	call   *%eax
  802c14:	89 c3                	mov    %eax,%ebx
  802c16:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  802c19:	83 ec 08             	sub    $0x8,%esp
  802c1c:	56                   	push   %esi
  802c1d:	6a 00                	push   $0x0
  802c1f:	e8 0c fb ff ff       	call   802730 <sys_page_unmap>
	return r;
  802c24:	83 c4 10             	add    $0x10,%esp
  802c27:	eb b5                	jmp    802bde <fd_close+0x40>

00802c29 <close>:

int
close(int fdnum)
{
  802c29:	f3 0f 1e fb          	endbr32 
  802c2d:	55                   	push   %ebp
  802c2e:	89 e5                	mov    %esp,%ebp
  802c30:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  802c33:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802c36:	50                   	push   %eax
  802c37:	ff 75 08             	pushl  0x8(%ebp)
  802c3a:	e8 b1 fe ff ff       	call   802af0 <fd_lookup>
  802c3f:	83 c4 10             	add    $0x10,%esp
  802c42:	85 c0                	test   %eax,%eax
  802c44:	79 02                	jns    802c48 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  802c46:	c9                   	leave  
  802c47:	c3                   	ret    
		return fd_close(fd, 1);
  802c48:	83 ec 08             	sub    $0x8,%esp
  802c4b:	6a 01                	push   $0x1
  802c4d:	ff 75 f4             	pushl  -0xc(%ebp)
  802c50:	e8 49 ff ff ff       	call   802b9e <fd_close>
  802c55:	83 c4 10             	add    $0x10,%esp
  802c58:	eb ec                	jmp    802c46 <close+0x1d>

00802c5a <close_all>:

void
close_all(void)
{
  802c5a:	f3 0f 1e fb          	endbr32 
  802c5e:	55                   	push   %ebp
  802c5f:	89 e5                	mov    %esp,%ebp
  802c61:	53                   	push   %ebx
  802c62:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  802c65:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  802c6a:	83 ec 0c             	sub    $0xc,%esp
  802c6d:	53                   	push   %ebx
  802c6e:	e8 b6 ff ff ff       	call   802c29 <close>
	for (i = 0; i < MAXFD; i++)
  802c73:	83 c3 01             	add    $0x1,%ebx
  802c76:	83 c4 10             	add    $0x10,%esp
  802c79:	83 fb 20             	cmp    $0x20,%ebx
  802c7c:	75 ec                	jne    802c6a <close_all+0x10>
}
  802c7e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  802c81:	c9                   	leave  
  802c82:	c3                   	ret    

00802c83 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  802c83:	f3 0f 1e fb          	endbr32 
  802c87:	55                   	push   %ebp
  802c88:	89 e5                	mov    %esp,%ebp
  802c8a:	57                   	push   %edi
  802c8b:	56                   	push   %esi
  802c8c:	53                   	push   %ebx
  802c8d:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  802c90:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  802c93:	50                   	push   %eax
  802c94:	ff 75 08             	pushl  0x8(%ebp)
  802c97:	e8 54 fe ff ff       	call   802af0 <fd_lookup>
  802c9c:	89 c3                	mov    %eax,%ebx
  802c9e:	83 c4 10             	add    $0x10,%esp
  802ca1:	85 c0                	test   %eax,%eax
  802ca3:	0f 88 81 00 00 00    	js     802d2a <dup+0xa7>
		return r;
	close(newfdnum);
  802ca9:	83 ec 0c             	sub    $0xc,%esp
  802cac:	ff 75 0c             	pushl  0xc(%ebp)
  802caf:	e8 75 ff ff ff       	call   802c29 <close>

	newfd = INDEX2FD(newfdnum);
  802cb4:	8b 75 0c             	mov    0xc(%ebp),%esi
  802cb7:	c1 e6 0c             	shl    $0xc,%esi
  802cba:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  802cc0:	83 c4 04             	add    $0x4,%esp
  802cc3:	ff 75 e4             	pushl  -0x1c(%ebp)
  802cc6:	e8 b4 fd ff ff       	call   802a7f <fd2data>
  802ccb:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  802ccd:	89 34 24             	mov    %esi,(%esp)
  802cd0:	e8 aa fd ff ff       	call   802a7f <fd2data>
  802cd5:	83 c4 10             	add    $0x10,%esp
  802cd8:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  802cda:	89 d8                	mov    %ebx,%eax
  802cdc:	c1 e8 16             	shr    $0x16,%eax
  802cdf:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  802ce6:	a8 01                	test   $0x1,%al
  802ce8:	74 11                	je     802cfb <dup+0x78>
  802cea:	89 d8                	mov    %ebx,%eax
  802cec:	c1 e8 0c             	shr    $0xc,%eax
  802cef:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  802cf6:	f6 c2 01             	test   $0x1,%dl
  802cf9:	75 39                	jne    802d34 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  802cfb:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  802cfe:	89 d0                	mov    %edx,%eax
  802d00:	c1 e8 0c             	shr    $0xc,%eax
  802d03:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  802d0a:	83 ec 0c             	sub    $0xc,%esp
  802d0d:	25 07 0e 00 00       	and    $0xe07,%eax
  802d12:	50                   	push   %eax
  802d13:	56                   	push   %esi
  802d14:	6a 00                	push   $0x0
  802d16:	52                   	push   %edx
  802d17:	6a 00                	push   $0x0
  802d19:	e8 cc f9 ff ff       	call   8026ea <sys_page_map>
  802d1e:	89 c3                	mov    %eax,%ebx
  802d20:	83 c4 20             	add    $0x20,%esp
  802d23:	85 c0                	test   %eax,%eax
  802d25:	78 31                	js     802d58 <dup+0xd5>
		goto err;

	return newfdnum;
  802d27:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  802d2a:	89 d8                	mov    %ebx,%eax
  802d2c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802d2f:	5b                   	pop    %ebx
  802d30:	5e                   	pop    %esi
  802d31:	5f                   	pop    %edi
  802d32:	5d                   	pop    %ebp
  802d33:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  802d34:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  802d3b:	83 ec 0c             	sub    $0xc,%esp
  802d3e:	25 07 0e 00 00       	and    $0xe07,%eax
  802d43:	50                   	push   %eax
  802d44:	57                   	push   %edi
  802d45:	6a 00                	push   $0x0
  802d47:	53                   	push   %ebx
  802d48:	6a 00                	push   $0x0
  802d4a:	e8 9b f9 ff ff       	call   8026ea <sys_page_map>
  802d4f:	89 c3                	mov    %eax,%ebx
  802d51:	83 c4 20             	add    $0x20,%esp
  802d54:	85 c0                	test   %eax,%eax
  802d56:	79 a3                	jns    802cfb <dup+0x78>
	sys_page_unmap(0, newfd);
  802d58:	83 ec 08             	sub    $0x8,%esp
  802d5b:	56                   	push   %esi
  802d5c:	6a 00                	push   $0x0
  802d5e:	e8 cd f9 ff ff       	call   802730 <sys_page_unmap>
	sys_page_unmap(0, nva);
  802d63:	83 c4 08             	add    $0x8,%esp
  802d66:	57                   	push   %edi
  802d67:	6a 00                	push   $0x0
  802d69:	e8 c2 f9 ff ff       	call   802730 <sys_page_unmap>
	return r;
  802d6e:	83 c4 10             	add    $0x10,%esp
  802d71:	eb b7                	jmp    802d2a <dup+0xa7>

00802d73 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  802d73:	f3 0f 1e fb          	endbr32 
  802d77:	55                   	push   %ebp
  802d78:	89 e5                	mov    %esp,%ebp
  802d7a:	53                   	push   %ebx
  802d7b:	83 ec 1c             	sub    $0x1c,%esp
  802d7e:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  802d81:	8d 45 f0             	lea    -0x10(%ebp),%eax
  802d84:	50                   	push   %eax
  802d85:	53                   	push   %ebx
  802d86:	e8 65 fd ff ff       	call   802af0 <fd_lookup>
  802d8b:	83 c4 10             	add    $0x10,%esp
  802d8e:	85 c0                	test   %eax,%eax
  802d90:	78 3f                	js     802dd1 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  802d92:	83 ec 08             	sub    $0x8,%esp
  802d95:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802d98:	50                   	push   %eax
  802d99:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802d9c:	ff 30                	pushl  (%eax)
  802d9e:	e8 a1 fd ff ff       	call   802b44 <dev_lookup>
  802da3:	83 c4 10             	add    $0x10,%esp
  802da6:	85 c0                	test   %eax,%eax
  802da8:	78 27                	js     802dd1 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  802daa:	8b 55 f0             	mov    -0x10(%ebp),%edx
  802dad:	8b 42 08             	mov    0x8(%edx),%eax
  802db0:	83 e0 03             	and    $0x3,%eax
  802db3:	83 f8 01             	cmp    $0x1,%eax
  802db6:	74 1e                	je     802dd6 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  802db8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802dbb:	8b 40 08             	mov    0x8(%eax),%eax
  802dbe:	85 c0                	test   %eax,%eax
  802dc0:	74 35                	je     802df7 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  802dc2:	83 ec 04             	sub    $0x4,%esp
  802dc5:	ff 75 10             	pushl  0x10(%ebp)
  802dc8:	ff 75 0c             	pushl  0xc(%ebp)
  802dcb:	52                   	push   %edx
  802dcc:	ff d0                	call   *%eax
  802dce:	83 c4 10             	add    $0x10,%esp
}
  802dd1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  802dd4:	c9                   	leave  
  802dd5:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  802dd6:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  802ddb:	8b 40 48             	mov    0x48(%eax),%eax
  802dde:	83 ec 04             	sub    $0x4,%esp
  802de1:	53                   	push   %ebx
  802de2:	50                   	push   %eax
  802de3:	68 1d 44 80 00       	push   $0x80441d
  802de8:	e8 9b ee ff ff       	call   801c88 <cprintf>
		return -E_INVAL;
  802ded:	83 c4 10             	add    $0x10,%esp
  802df0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802df5:	eb da                	jmp    802dd1 <read+0x5e>
		return -E_NOT_SUPP;
  802df7:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  802dfc:	eb d3                	jmp    802dd1 <read+0x5e>

00802dfe <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  802dfe:	f3 0f 1e fb          	endbr32 
  802e02:	55                   	push   %ebp
  802e03:	89 e5                	mov    %esp,%ebp
  802e05:	57                   	push   %edi
  802e06:	56                   	push   %esi
  802e07:	53                   	push   %ebx
  802e08:	83 ec 0c             	sub    $0xc,%esp
  802e0b:	8b 7d 08             	mov    0x8(%ebp),%edi
  802e0e:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  802e11:	bb 00 00 00 00       	mov    $0x0,%ebx
  802e16:	eb 02                	jmp    802e1a <readn+0x1c>
  802e18:	01 c3                	add    %eax,%ebx
  802e1a:	39 f3                	cmp    %esi,%ebx
  802e1c:	73 21                	jae    802e3f <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  802e1e:	83 ec 04             	sub    $0x4,%esp
  802e21:	89 f0                	mov    %esi,%eax
  802e23:	29 d8                	sub    %ebx,%eax
  802e25:	50                   	push   %eax
  802e26:	89 d8                	mov    %ebx,%eax
  802e28:	03 45 0c             	add    0xc(%ebp),%eax
  802e2b:	50                   	push   %eax
  802e2c:	57                   	push   %edi
  802e2d:	e8 41 ff ff ff       	call   802d73 <read>
		if (m < 0)
  802e32:	83 c4 10             	add    $0x10,%esp
  802e35:	85 c0                	test   %eax,%eax
  802e37:	78 04                	js     802e3d <readn+0x3f>
			return m;
		if (m == 0)
  802e39:	75 dd                	jne    802e18 <readn+0x1a>
  802e3b:	eb 02                	jmp    802e3f <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  802e3d:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  802e3f:	89 d8                	mov    %ebx,%eax
  802e41:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802e44:	5b                   	pop    %ebx
  802e45:	5e                   	pop    %esi
  802e46:	5f                   	pop    %edi
  802e47:	5d                   	pop    %ebp
  802e48:	c3                   	ret    

00802e49 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  802e49:	f3 0f 1e fb          	endbr32 
  802e4d:	55                   	push   %ebp
  802e4e:	89 e5                	mov    %esp,%ebp
  802e50:	53                   	push   %ebx
  802e51:	83 ec 1c             	sub    $0x1c,%esp
  802e54:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  802e57:	8d 45 f0             	lea    -0x10(%ebp),%eax
  802e5a:	50                   	push   %eax
  802e5b:	53                   	push   %ebx
  802e5c:	e8 8f fc ff ff       	call   802af0 <fd_lookup>
  802e61:	83 c4 10             	add    $0x10,%esp
  802e64:	85 c0                	test   %eax,%eax
  802e66:	78 3a                	js     802ea2 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  802e68:	83 ec 08             	sub    $0x8,%esp
  802e6b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802e6e:	50                   	push   %eax
  802e6f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802e72:	ff 30                	pushl  (%eax)
  802e74:	e8 cb fc ff ff       	call   802b44 <dev_lookup>
  802e79:	83 c4 10             	add    $0x10,%esp
  802e7c:	85 c0                	test   %eax,%eax
  802e7e:	78 22                	js     802ea2 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  802e80:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802e83:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  802e87:	74 1e                	je     802ea7 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  802e89:	8b 55 f4             	mov    -0xc(%ebp),%edx
  802e8c:	8b 52 0c             	mov    0xc(%edx),%edx
  802e8f:	85 d2                	test   %edx,%edx
  802e91:	74 35                	je     802ec8 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  802e93:	83 ec 04             	sub    $0x4,%esp
  802e96:	ff 75 10             	pushl  0x10(%ebp)
  802e99:	ff 75 0c             	pushl  0xc(%ebp)
  802e9c:	50                   	push   %eax
  802e9d:	ff d2                	call   *%edx
  802e9f:	83 c4 10             	add    $0x10,%esp
}
  802ea2:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  802ea5:	c9                   	leave  
  802ea6:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  802ea7:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  802eac:	8b 40 48             	mov    0x48(%eax),%eax
  802eaf:	83 ec 04             	sub    $0x4,%esp
  802eb2:	53                   	push   %ebx
  802eb3:	50                   	push   %eax
  802eb4:	68 39 44 80 00       	push   $0x804439
  802eb9:	e8 ca ed ff ff       	call   801c88 <cprintf>
		return -E_INVAL;
  802ebe:	83 c4 10             	add    $0x10,%esp
  802ec1:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802ec6:	eb da                	jmp    802ea2 <write+0x59>
		return -E_NOT_SUPP;
  802ec8:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  802ecd:	eb d3                	jmp    802ea2 <write+0x59>

00802ecf <seek>:

int
seek(int fdnum, off_t offset)
{
  802ecf:	f3 0f 1e fb          	endbr32 
  802ed3:	55                   	push   %ebp
  802ed4:	89 e5                	mov    %esp,%ebp
  802ed6:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  802ed9:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802edc:	50                   	push   %eax
  802edd:	ff 75 08             	pushl  0x8(%ebp)
  802ee0:	e8 0b fc ff ff       	call   802af0 <fd_lookup>
  802ee5:	83 c4 10             	add    $0x10,%esp
  802ee8:	85 c0                	test   %eax,%eax
  802eea:	78 0e                	js     802efa <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  802eec:	8b 55 0c             	mov    0xc(%ebp),%edx
  802eef:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802ef2:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  802ef5:	b8 00 00 00 00       	mov    $0x0,%eax
}
  802efa:	c9                   	leave  
  802efb:	c3                   	ret    

00802efc <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  802efc:	f3 0f 1e fb          	endbr32 
  802f00:	55                   	push   %ebp
  802f01:	89 e5                	mov    %esp,%ebp
  802f03:	53                   	push   %ebx
  802f04:	83 ec 1c             	sub    $0x1c,%esp
  802f07:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  802f0a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  802f0d:	50                   	push   %eax
  802f0e:	53                   	push   %ebx
  802f0f:	e8 dc fb ff ff       	call   802af0 <fd_lookup>
  802f14:	83 c4 10             	add    $0x10,%esp
  802f17:	85 c0                	test   %eax,%eax
  802f19:	78 37                	js     802f52 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  802f1b:	83 ec 08             	sub    $0x8,%esp
  802f1e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802f21:	50                   	push   %eax
  802f22:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802f25:	ff 30                	pushl  (%eax)
  802f27:	e8 18 fc ff ff       	call   802b44 <dev_lookup>
  802f2c:	83 c4 10             	add    $0x10,%esp
  802f2f:	85 c0                	test   %eax,%eax
  802f31:	78 1f                	js     802f52 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  802f33:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802f36:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  802f3a:	74 1b                	je     802f57 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  802f3c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  802f3f:	8b 52 18             	mov    0x18(%edx),%edx
  802f42:	85 d2                	test   %edx,%edx
  802f44:	74 32                	je     802f78 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  802f46:	83 ec 08             	sub    $0x8,%esp
  802f49:	ff 75 0c             	pushl  0xc(%ebp)
  802f4c:	50                   	push   %eax
  802f4d:	ff d2                	call   *%edx
  802f4f:	83 c4 10             	add    $0x10,%esp
}
  802f52:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  802f55:	c9                   	leave  
  802f56:	c3                   	ret    
			thisenv->env_id, fdnum);
  802f57:	a1 0c a0 80 00       	mov    0x80a00c,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  802f5c:	8b 40 48             	mov    0x48(%eax),%eax
  802f5f:	83 ec 04             	sub    $0x4,%esp
  802f62:	53                   	push   %ebx
  802f63:	50                   	push   %eax
  802f64:	68 fc 43 80 00       	push   $0x8043fc
  802f69:	e8 1a ed ff ff       	call   801c88 <cprintf>
		return -E_INVAL;
  802f6e:	83 c4 10             	add    $0x10,%esp
  802f71:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  802f76:	eb da                	jmp    802f52 <ftruncate+0x56>
		return -E_NOT_SUPP;
  802f78:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  802f7d:	eb d3                	jmp    802f52 <ftruncate+0x56>

00802f7f <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  802f7f:	f3 0f 1e fb          	endbr32 
  802f83:	55                   	push   %ebp
  802f84:	89 e5                	mov    %esp,%ebp
  802f86:	53                   	push   %ebx
  802f87:	83 ec 1c             	sub    $0x1c,%esp
  802f8a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  802f8d:	8d 45 f0             	lea    -0x10(%ebp),%eax
  802f90:	50                   	push   %eax
  802f91:	ff 75 08             	pushl  0x8(%ebp)
  802f94:	e8 57 fb ff ff       	call   802af0 <fd_lookup>
  802f99:	83 c4 10             	add    $0x10,%esp
  802f9c:	85 c0                	test   %eax,%eax
  802f9e:	78 4b                	js     802feb <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  802fa0:	83 ec 08             	sub    $0x8,%esp
  802fa3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802fa6:	50                   	push   %eax
  802fa7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802faa:	ff 30                	pushl  (%eax)
  802fac:	e8 93 fb ff ff       	call   802b44 <dev_lookup>
  802fb1:	83 c4 10             	add    $0x10,%esp
  802fb4:	85 c0                	test   %eax,%eax
  802fb6:	78 33                	js     802feb <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  802fb8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802fbb:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  802fbf:	74 2f                	je     802ff0 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  802fc1:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  802fc4:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  802fcb:	00 00 00 
	stat->st_isdir = 0;
  802fce:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  802fd5:	00 00 00 
	stat->st_dev = dev;
  802fd8:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  802fde:	83 ec 08             	sub    $0x8,%esp
  802fe1:	53                   	push   %ebx
  802fe2:	ff 75 f0             	pushl  -0x10(%ebp)
  802fe5:	ff 50 14             	call   *0x14(%eax)
  802fe8:	83 c4 10             	add    $0x10,%esp
}
  802feb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  802fee:	c9                   	leave  
  802fef:	c3                   	ret    
		return -E_NOT_SUPP;
  802ff0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  802ff5:	eb f4                	jmp    802feb <fstat+0x6c>

00802ff7 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  802ff7:	f3 0f 1e fb          	endbr32 
  802ffb:	55                   	push   %ebp
  802ffc:	89 e5                	mov    %esp,%ebp
  802ffe:	56                   	push   %esi
  802fff:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  803000:	83 ec 08             	sub    $0x8,%esp
  803003:	6a 00                	push   $0x0
  803005:	ff 75 08             	pushl  0x8(%ebp)
  803008:	e8 fb 01 00 00       	call   803208 <open>
  80300d:	89 c3                	mov    %eax,%ebx
  80300f:	83 c4 10             	add    $0x10,%esp
  803012:	85 c0                	test   %eax,%eax
  803014:	78 1b                	js     803031 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  803016:	83 ec 08             	sub    $0x8,%esp
  803019:	ff 75 0c             	pushl  0xc(%ebp)
  80301c:	50                   	push   %eax
  80301d:	e8 5d ff ff ff       	call   802f7f <fstat>
  803022:	89 c6                	mov    %eax,%esi
	close(fd);
  803024:	89 1c 24             	mov    %ebx,(%esp)
  803027:	e8 fd fb ff ff       	call   802c29 <close>
	return r;
  80302c:	83 c4 10             	add    $0x10,%esp
  80302f:	89 f3                	mov    %esi,%ebx
}
  803031:	89 d8                	mov    %ebx,%eax
  803033:	8d 65 f8             	lea    -0x8(%ebp),%esp
  803036:	5b                   	pop    %ebx
  803037:	5e                   	pop    %esi
  803038:	5d                   	pop    %ebp
  803039:	c3                   	ret    

0080303a <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  80303a:	55                   	push   %ebp
  80303b:	89 e5                	mov    %esp,%ebp
  80303d:	56                   	push   %esi
  80303e:	53                   	push   %ebx
  80303f:	89 c6                	mov    %eax,%esi
  803041:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  803043:	83 3d 00 a0 80 00 00 	cmpl   $0x0,0x80a000
  80304a:	74 27                	je     803073 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80304c:	6a 07                	push   $0x7
  80304e:	68 00 b0 80 00       	push   $0x80b000
  803053:	56                   	push   %esi
  803054:	ff 35 00 a0 80 00    	pushl  0x80a000
  80305a:	e8 77 f9 ff ff       	call   8029d6 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80305f:	83 c4 0c             	add    $0xc,%esp
  803062:	6a 00                	push   $0x0
  803064:	53                   	push   %ebx
  803065:	6a 00                	push   $0x0
  803067:	e8 e9 f8 ff ff       	call   802955 <ipc_recv>
}
  80306c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80306f:	5b                   	pop    %ebx
  803070:	5e                   	pop    %esi
  803071:	5d                   	pop    %ebp
  803072:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  803073:	83 ec 0c             	sub    $0xc,%esp
  803076:	6a 01                	push   $0x1
  803078:	e8 b1 f9 ff ff       	call   802a2e <ipc_find_env>
  80307d:	a3 00 a0 80 00       	mov    %eax,0x80a000
  803082:	83 c4 10             	add    $0x10,%esp
  803085:	eb c5                	jmp    80304c <fsipc+0x12>

00803087 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  803087:	f3 0f 1e fb          	endbr32 
  80308b:	55                   	push   %ebp
  80308c:	89 e5                	mov    %esp,%ebp
  80308e:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  803091:	8b 45 08             	mov    0x8(%ebp),%eax
  803094:	8b 40 0c             	mov    0xc(%eax),%eax
  803097:	a3 00 b0 80 00       	mov    %eax,0x80b000
	fsipcbuf.set_size.req_size = newsize;
  80309c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80309f:	a3 04 b0 80 00       	mov    %eax,0x80b004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8030a4:	ba 00 00 00 00       	mov    $0x0,%edx
  8030a9:	b8 02 00 00 00       	mov    $0x2,%eax
  8030ae:	e8 87 ff ff ff       	call   80303a <fsipc>
}
  8030b3:	c9                   	leave  
  8030b4:	c3                   	ret    

008030b5 <devfile_flush>:
{
  8030b5:	f3 0f 1e fb          	endbr32 
  8030b9:	55                   	push   %ebp
  8030ba:	89 e5                	mov    %esp,%ebp
  8030bc:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8030bf:	8b 45 08             	mov    0x8(%ebp),%eax
  8030c2:	8b 40 0c             	mov    0xc(%eax),%eax
  8030c5:	a3 00 b0 80 00       	mov    %eax,0x80b000
	return fsipc(FSREQ_FLUSH, NULL);
  8030ca:	ba 00 00 00 00       	mov    $0x0,%edx
  8030cf:	b8 06 00 00 00       	mov    $0x6,%eax
  8030d4:	e8 61 ff ff ff       	call   80303a <fsipc>
}
  8030d9:	c9                   	leave  
  8030da:	c3                   	ret    

008030db <devfile_stat>:
{
  8030db:	f3 0f 1e fb          	endbr32 
  8030df:	55                   	push   %ebp
  8030e0:	89 e5                	mov    %esp,%ebp
  8030e2:	53                   	push   %ebx
  8030e3:	83 ec 04             	sub    $0x4,%esp
  8030e6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8030e9:	8b 45 08             	mov    0x8(%ebp),%eax
  8030ec:	8b 40 0c             	mov    0xc(%eax),%eax
  8030ef:	a3 00 b0 80 00       	mov    %eax,0x80b000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8030f4:	ba 00 00 00 00       	mov    $0x0,%edx
  8030f9:	b8 05 00 00 00       	mov    $0x5,%eax
  8030fe:	e8 37 ff ff ff       	call   80303a <fsipc>
  803103:	85 c0                	test   %eax,%eax
  803105:	78 2c                	js     803133 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  803107:	83 ec 08             	sub    $0x8,%esp
  80310a:	68 00 b0 80 00       	push   $0x80b000
  80310f:	53                   	push   %ebx
  803110:	e8 4c f1 ff ff       	call   802261 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  803115:	a1 80 b0 80 00       	mov    0x80b080,%eax
  80311a:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  803120:	a1 84 b0 80 00       	mov    0x80b084,%eax
  803125:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80312b:	83 c4 10             	add    $0x10,%esp
  80312e:	b8 00 00 00 00       	mov    $0x0,%eax
}
  803133:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  803136:	c9                   	leave  
  803137:	c3                   	ret    

00803138 <devfile_write>:
{
  803138:	f3 0f 1e fb          	endbr32 
  80313c:	55                   	push   %ebp
  80313d:	89 e5                	mov    %esp,%ebp
  80313f:	83 ec 0c             	sub    $0xc,%esp
  803142:	8b 45 10             	mov    0x10(%ebp),%eax
  803145:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  80314a:	ba f8 0f 00 00       	mov    $0xff8,%edx
  80314f:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  803152:	8b 55 08             	mov    0x8(%ebp),%edx
  803155:	8b 52 0c             	mov    0xc(%edx),%edx
  803158:	89 15 00 b0 80 00    	mov    %edx,0x80b000
	fsipcbuf.write.req_n = n;
  80315e:	a3 04 b0 80 00       	mov    %eax,0x80b004
	memmove(fsipcbuf.write.req_buf, buf, n);
  803163:	50                   	push   %eax
  803164:	ff 75 0c             	pushl  0xc(%ebp)
  803167:	68 08 b0 80 00       	push   $0x80b008
  80316c:	e8 a6 f2 ff ff       	call   802417 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  803171:	ba 00 00 00 00       	mov    $0x0,%edx
  803176:	b8 04 00 00 00       	mov    $0x4,%eax
  80317b:	e8 ba fe ff ff       	call   80303a <fsipc>
  803180:	c9                   	leave  
  803181:	c3                   	ret    

00803182 <devfile_read>:
{
  803182:	f3 0f 1e fb          	endbr32 
  803186:	55                   	push   %ebp
  803187:	89 e5                	mov    %esp,%ebp
  803189:	56                   	push   %esi
  80318a:	53                   	push   %ebx
  80318b:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  80318e:	8b 45 08             	mov    0x8(%ebp),%eax
  803191:	8b 40 0c             	mov    0xc(%eax),%eax
  803194:	a3 00 b0 80 00       	mov    %eax,0x80b000
	fsipcbuf.read.req_n = n;
  803199:	89 35 04 b0 80 00    	mov    %esi,0x80b004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  80319f:	ba 00 00 00 00       	mov    $0x0,%edx
  8031a4:	b8 03 00 00 00       	mov    $0x3,%eax
  8031a9:	e8 8c fe ff ff       	call   80303a <fsipc>
  8031ae:	89 c3                	mov    %eax,%ebx
  8031b0:	85 c0                	test   %eax,%eax
  8031b2:	78 1f                	js     8031d3 <devfile_read+0x51>
	assert(r <= n);
  8031b4:	39 f0                	cmp    %esi,%eax
  8031b6:	77 24                	ja     8031dc <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8031b8:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8031bd:	7f 33                	jg     8031f2 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8031bf:	83 ec 04             	sub    $0x4,%esp
  8031c2:	50                   	push   %eax
  8031c3:	68 00 b0 80 00       	push   $0x80b000
  8031c8:	ff 75 0c             	pushl  0xc(%ebp)
  8031cb:	e8 47 f2 ff ff       	call   802417 <memmove>
	return r;
  8031d0:	83 c4 10             	add    $0x10,%esp
}
  8031d3:	89 d8                	mov    %ebx,%eax
  8031d5:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8031d8:	5b                   	pop    %ebx
  8031d9:	5e                   	pop    %esi
  8031da:	5d                   	pop    %ebp
  8031db:	c3                   	ret    
	assert(r <= n);
  8031dc:	68 68 44 80 00       	push   $0x804468
  8031e1:	68 9d 3a 80 00       	push   $0x803a9d
  8031e6:	6a 7c                	push   $0x7c
  8031e8:	68 6f 44 80 00       	push   $0x80446f
  8031ed:	e8 af e9 ff ff       	call   801ba1 <_panic>
	assert(r <= PGSIZE);
  8031f2:	68 7a 44 80 00       	push   $0x80447a
  8031f7:	68 9d 3a 80 00       	push   $0x803a9d
  8031fc:	6a 7d                	push   $0x7d
  8031fe:	68 6f 44 80 00       	push   $0x80446f
  803203:	e8 99 e9 ff ff       	call   801ba1 <_panic>

00803208 <open>:
{
  803208:	f3 0f 1e fb          	endbr32 
  80320c:	55                   	push   %ebp
  80320d:	89 e5                	mov    %esp,%ebp
  80320f:	56                   	push   %esi
  803210:	53                   	push   %ebx
  803211:	83 ec 1c             	sub    $0x1c,%esp
  803214:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  803217:	56                   	push   %esi
  803218:	e8 01 f0 ff ff       	call   80221e <strlen>
  80321d:	83 c4 10             	add    $0x10,%esp
  803220:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  803225:	7f 6c                	jg     803293 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  803227:	83 ec 0c             	sub    $0xc,%esp
  80322a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80322d:	50                   	push   %eax
  80322e:	e8 67 f8 ff ff       	call   802a9a <fd_alloc>
  803233:	89 c3                	mov    %eax,%ebx
  803235:	83 c4 10             	add    $0x10,%esp
  803238:	85 c0                	test   %eax,%eax
  80323a:	78 3c                	js     803278 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  80323c:	83 ec 08             	sub    $0x8,%esp
  80323f:	56                   	push   %esi
  803240:	68 00 b0 80 00       	push   $0x80b000
  803245:	e8 17 f0 ff ff       	call   802261 <strcpy>
	fsipcbuf.open.req_omode = mode;
  80324a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80324d:	a3 00 b4 80 00       	mov    %eax,0x80b400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  803252:	8b 55 f4             	mov    -0xc(%ebp),%edx
  803255:	b8 01 00 00 00       	mov    $0x1,%eax
  80325a:	e8 db fd ff ff       	call   80303a <fsipc>
  80325f:	89 c3                	mov    %eax,%ebx
  803261:	83 c4 10             	add    $0x10,%esp
  803264:	85 c0                	test   %eax,%eax
  803266:	78 19                	js     803281 <open+0x79>
	return fd2num(fd);
  803268:	83 ec 0c             	sub    $0xc,%esp
  80326b:	ff 75 f4             	pushl  -0xc(%ebp)
  80326e:	e8 f8 f7 ff ff       	call   802a6b <fd2num>
  803273:	89 c3                	mov    %eax,%ebx
  803275:	83 c4 10             	add    $0x10,%esp
}
  803278:	89 d8                	mov    %ebx,%eax
  80327a:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80327d:	5b                   	pop    %ebx
  80327e:	5e                   	pop    %esi
  80327f:	5d                   	pop    %ebp
  803280:	c3                   	ret    
		fd_close(fd, 0);
  803281:	83 ec 08             	sub    $0x8,%esp
  803284:	6a 00                	push   $0x0
  803286:	ff 75 f4             	pushl  -0xc(%ebp)
  803289:	e8 10 f9 ff ff       	call   802b9e <fd_close>
		return r;
  80328e:	83 c4 10             	add    $0x10,%esp
  803291:	eb e5                	jmp    803278 <open+0x70>
		return -E_BAD_PATH;
  803293:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  803298:	eb de                	jmp    803278 <open+0x70>

0080329a <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  80329a:	f3 0f 1e fb          	endbr32 
  80329e:	55                   	push   %ebp
  80329f:	89 e5                	mov    %esp,%ebp
  8032a1:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  8032a4:	ba 00 00 00 00       	mov    $0x0,%edx
  8032a9:	b8 08 00 00 00       	mov    $0x8,%eax
  8032ae:	e8 87 fd ff ff       	call   80303a <fsipc>
}
  8032b3:	c9                   	leave  
  8032b4:	c3                   	ret    

008032b5 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8032b5:	f3 0f 1e fb          	endbr32 
  8032b9:	55                   	push   %ebp
  8032ba:	89 e5                	mov    %esp,%ebp
  8032bc:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8032bf:	89 c2                	mov    %eax,%edx
  8032c1:	c1 ea 16             	shr    $0x16,%edx
  8032c4:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8032cb:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8032d0:	f6 c1 01             	test   $0x1,%cl
  8032d3:	74 1c                	je     8032f1 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8032d5:	c1 e8 0c             	shr    $0xc,%eax
  8032d8:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8032df:	a8 01                	test   $0x1,%al
  8032e1:	74 0e                	je     8032f1 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8032e3:	c1 e8 0c             	shr    $0xc,%eax
  8032e6:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8032ed:	ef 
  8032ee:	0f b7 d2             	movzwl %dx,%edx
}
  8032f1:	89 d0                	mov    %edx,%eax
  8032f3:	5d                   	pop    %ebp
  8032f4:	c3                   	ret    

008032f5 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  8032f5:	f3 0f 1e fb          	endbr32 
  8032f9:	55                   	push   %ebp
  8032fa:	89 e5                	mov    %esp,%ebp
  8032fc:	56                   	push   %esi
  8032fd:	53                   	push   %ebx
  8032fe:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  803301:	83 ec 0c             	sub    $0xc,%esp
  803304:	ff 75 08             	pushl  0x8(%ebp)
  803307:	e8 73 f7 ff ff       	call   802a7f <fd2data>
  80330c:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  80330e:	83 c4 08             	add    $0x8,%esp
  803311:	68 86 44 80 00       	push   $0x804486
  803316:	53                   	push   %ebx
  803317:	e8 45 ef ff ff       	call   802261 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  80331c:	8b 46 04             	mov    0x4(%esi),%eax
  80331f:	2b 06                	sub    (%esi),%eax
  803321:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  803327:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80332e:	00 00 00 
	stat->st_dev = &devpipe;
  803331:	c7 83 88 00 00 00 80 	movl   $0x809080,0x88(%ebx)
  803338:	90 80 00 
	return 0;
}
  80333b:	b8 00 00 00 00       	mov    $0x0,%eax
  803340:	8d 65 f8             	lea    -0x8(%ebp),%esp
  803343:	5b                   	pop    %ebx
  803344:	5e                   	pop    %esi
  803345:	5d                   	pop    %ebp
  803346:	c3                   	ret    

00803347 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  803347:	f3 0f 1e fb          	endbr32 
  80334b:	55                   	push   %ebp
  80334c:	89 e5                	mov    %esp,%ebp
  80334e:	53                   	push   %ebx
  80334f:	83 ec 0c             	sub    $0xc,%esp
  803352:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  803355:	53                   	push   %ebx
  803356:	6a 00                	push   $0x0
  803358:	e8 d3 f3 ff ff       	call   802730 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  80335d:	89 1c 24             	mov    %ebx,(%esp)
  803360:	e8 1a f7 ff ff       	call   802a7f <fd2data>
  803365:	83 c4 08             	add    $0x8,%esp
  803368:	50                   	push   %eax
  803369:	6a 00                	push   $0x0
  80336b:	e8 c0 f3 ff ff       	call   802730 <sys_page_unmap>
}
  803370:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  803373:	c9                   	leave  
  803374:	c3                   	ret    

00803375 <_pipeisclosed>:
{
  803375:	55                   	push   %ebp
  803376:	89 e5                	mov    %esp,%ebp
  803378:	57                   	push   %edi
  803379:	56                   	push   %esi
  80337a:	53                   	push   %ebx
  80337b:	83 ec 1c             	sub    $0x1c,%esp
  80337e:	89 c7                	mov    %eax,%edi
  803380:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  803382:	a1 0c a0 80 00       	mov    0x80a00c,%eax
  803387:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  80338a:	83 ec 0c             	sub    $0xc,%esp
  80338d:	57                   	push   %edi
  80338e:	e8 22 ff ff ff       	call   8032b5 <pageref>
  803393:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  803396:	89 34 24             	mov    %esi,(%esp)
  803399:	e8 17 ff ff ff       	call   8032b5 <pageref>
		nn = thisenv->env_runs;
  80339e:	8b 15 0c a0 80 00    	mov    0x80a00c,%edx
  8033a4:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  8033a7:	83 c4 10             	add    $0x10,%esp
  8033aa:	39 cb                	cmp    %ecx,%ebx
  8033ac:	74 1b                	je     8033c9 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  8033ae:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  8033b1:	75 cf                	jne    803382 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  8033b3:	8b 42 58             	mov    0x58(%edx),%eax
  8033b6:	6a 01                	push   $0x1
  8033b8:	50                   	push   %eax
  8033b9:	53                   	push   %ebx
  8033ba:	68 8d 44 80 00       	push   $0x80448d
  8033bf:	e8 c4 e8 ff ff       	call   801c88 <cprintf>
  8033c4:	83 c4 10             	add    $0x10,%esp
  8033c7:	eb b9                	jmp    803382 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  8033c9:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  8033cc:	0f 94 c0             	sete   %al
  8033cf:	0f b6 c0             	movzbl %al,%eax
}
  8033d2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8033d5:	5b                   	pop    %ebx
  8033d6:	5e                   	pop    %esi
  8033d7:	5f                   	pop    %edi
  8033d8:	5d                   	pop    %ebp
  8033d9:	c3                   	ret    

008033da <devpipe_write>:
{
  8033da:	f3 0f 1e fb          	endbr32 
  8033de:	55                   	push   %ebp
  8033df:	89 e5                	mov    %esp,%ebp
  8033e1:	57                   	push   %edi
  8033e2:	56                   	push   %esi
  8033e3:	53                   	push   %ebx
  8033e4:	83 ec 28             	sub    $0x28,%esp
  8033e7:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  8033ea:	56                   	push   %esi
  8033eb:	e8 8f f6 ff ff       	call   802a7f <fd2data>
  8033f0:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  8033f2:	83 c4 10             	add    $0x10,%esp
  8033f5:	bf 00 00 00 00       	mov    $0x0,%edi
  8033fa:	3b 7d 10             	cmp    0x10(%ebp),%edi
  8033fd:	74 4f                	je     80344e <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  8033ff:	8b 43 04             	mov    0x4(%ebx),%eax
  803402:	8b 0b                	mov    (%ebx),%ecx
  803404:	8d 51 20             	lea    0x20(%ecx),%edx
  803407:	39 d0                	cmp    %edx,%eax
  803409:	72 14                	jb     80341f <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  80340b:	89 da                	mov    %ebx,%edx
  80340d:	89 f0                	mov    %esi,%eax
  80340f:	e8 61 ff ff ff       	call   803375 <_pipeisclosed>
  803414:	85 c0                	test   %eax,%eax
  803416:	75 3b                	jne    803453 <devpipe_write+0x79>
			sys_yield();
  803418:	e8 63 f2 ff ff       	call   802680 <sys_yield>
  80341d:	eb e0                	jmp    8033ff <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  80341f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  803422:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  803426:	88 4d e7             	mov    %cl,-0x19(%ebp)
  803429:	89 c2                	mov    %eax,%edx
  80342b:	c1 fa 1f             	sar    $0x1f,%edx
  80342e:	89 d1                	mov    %edx,%ecx
  803430:	c1 e9 1b             	shr    $0x1b,%ecx
  803433:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  803436:	83 e2 1f             	and    $0x1f,%edx
  803439:	29 ca                	sub    %ecx,%edx
  80343b:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  80343f:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  803443:	83 c0 01             	add    $0x1,%eax
  803446:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  803449:	83 c7 01             	add    $0x1,%edi
  80344c:	eb ac                	jmp    8033fa <devpipe_write+0x20>
	return i;
  80344e:	8b 45 10             	mov    0x10(%ebp),%eax
  803451:	eb 05                	jmp    803458 <devpipe_write+0x7e>
				return 0;
  803453:	b8 00 00 00 00       	mov    $0x0,%eax
}
  803458:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80345b:	5b                   	pop    %ebx
  80345c:	5e                   	pop    %esi
  80345d:	5f                   	pop    %edi
  80345e:	5d                   	pop    %ebp
  80345f:	c3                   	ret    

00803460 <devpipe_read>:
{
  803460:	f3 0f 1e fb          	endbr32 
  803464:	55                   	push   %ebp
  803465:	89 e5                	mov    %esp,%ebp
  803467:	57                   	push   %edi
  803468:	56                   	push   %esi
  803469:	53                   	push   %ebx
  80346a:	83 ec 18             	sub    $0x18,%esp
  80346d:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  803470:	57                   	push   %edi
  803471:	e8 09 f6 ff ff       	call   802a7f <fd2data>
  803476:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  803478:	83 c4 10             	add    $0x10,%esp
  80347b:	be 00 00 00 00       	mov    $0x0,%esi
  803480:	3b 75 10             	cmp    0x10(%ebp),%esi
  803483:	75 14                	jne    803499 <devpipe_read+0x39>
	return i;
  803485:	8b 45 10             	mov    0x10(%ebp),%eax
  803488:	eb 02                	jmp    80348c <devpipe_read+0x2c>
				return i;
  80348a:	89 f0                	mov    %esi,%eax
}
  80348c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80348f:	5b                   	pop    %ebx
  803490:	5e                   	pop    %esi
  803491:	5f                   	pop    %edi
  803492:	5d                   	pop    %ebp
  803493:	c3                   	ret    
			sys_yield();
  803494:	e8 e7 f1 ff ff       	call   802680 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  803499:	8b 03                	mov    (%ebx),%eax
  80349b:	3b 43 04             	cmp    0x4(%ebx),%eax
  80349e:	75 18                	jne    8034b8 <devpipe_read+0x58>
			if (i > 0)
  8034a0:	85 f6                	test   %esi,%esi
  8034a2:	75 e6                	jne    80348a <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  8034a4:	89 da                	mov    %ebx,%edx
  8034a6:	89 f8                	mov    %edi,%eax
  8034a8:	e8 c8 fe ff ff       	call   803375 <_pipeisclosed>
  8034ad:	85 c0                	test   %eax,%eax
  8034af:	74 e3                	je     803494 <devpipe_read+0x34>
				return 0;
  8034b1:	b8 00 00 00 00       	mov    $0x0,%eax
  8034b6:	eb d4                	jmp    80348c <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  8034b8:	99                   	cltd   
  8034b9:	c1 ea 1b             	shr    $0x1b,%edx
  8034bc:	01 d0                	add    %edx,%eax
  8034be:	83 e0 1f             	and    $0x1f,%eax
  8034c1:	29 d0                	sub    %edx,%eax
  8034c3:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  8034c8:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8034cb:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  8034ce:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  8034d1:	83 c6 01             	add    $0x1,%esi
  8034d4:	eb aa                	jmp    803480 <devpipe_read+0x20>

008034d6 <pipe>:
{
  8034d6:	f3 0f 1e fb          	endbr32 
  8034da:	55                   	push   %ebp
  8034db:	89 e5                	mov    %esp,%ebp
  8034dd:	56                   	push   %esi
  8034de:	53                   	push   %ebx
  8034df:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  8034e2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8034e5:	50                   	push   %eax
  8034e6:	e8 af f5 ff ff       	call   802a9a <fd_alloc>
  8034eb:	89 c3                	mov    %eax,%ebx
  8034ed:	83 c4 10             	add    $0x10,%esp
  8034f0:	85 c0                	test   %eax,%eax
  8034f2:	0f 88 23 01 00 00    	js     80361b <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  8034f8:	83 ec 04             	sub    $0x4,%esp
  8034fb:	68 07 04 00 00       	push   $0x407
  803500:	ff 75 f4             	pushl  -0xc(%ebp)
  803503:	6a 00                	push   $0x0
  803505:	e8 99 f1 ff ff       	call   8026a3 <sys_page_alloc>
  80350a:	89 c3                	mov    %eax,%ebx
  80350c:	83 c4 10             	add    $0x10,%esp
  80350f:	85 c0                	test   %eax,%eax
  803511:	0f 88 04 01 00 00    	js     80361b <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  803517:	83 ec 0c             	sub    $0xc,%esp
  80351a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80351d:	50                   	push   %eax
  80351e:	e8 77 f5 ff ff       	call   802a9a <fd_alloc>
  803523:	89 c3                	mov    %eax,%ebx
  803525:	83 c4 10             	add    $0x10,%esp
  803528:	85 c0                	test   %eax,%eax
  80352a:	0f 88 db 00 00 00    	js     80360b <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  803530:	83 ec 04             	sub    $0x4,%esp
  803533:	68 07 04 00 00       	push   $0x407
  803538:	ff 75 f0             	pushl  -0x10(%ebp)
  80353b:	6a 00                	push   $0x0
  80353d:	e8 61 f1 ff ff       	call   8026a3 <sys_page_alloc>
  803542:	89 c3                	mov    %eax,%ebx
  803544:	83 c4 10             	add    $0x10,%esp
  803547:	85 c0                	test   %eax,%eax
  803549:	0f 88 bc 00 00 00    	js     80360b <pipe+0x135>
	va = fd2data(fd0);
  80354f:	83 ec 0c             	sub    $0xc,%esp
  803552:	ff 75 f4             	pushl  -0xc(%ebp)
  803555:	e8 25 f5 ff ff       	call   802a7f <fd2data>
  80355a:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  80355c:	83 c4 0c             	add    $0xc,%esp
  80355f:	68 07 04 00 00       	push   $0x407
  803564:	50                   	push   %eax
  803565:	6a 00                	push   $0x0
  803567:	e8 37 f1 ff ff       	call   8026a3 <sys_page_alloc>
  80356c:	89 c3                	mov    %eax,%ebx
  80356e:	83 c4 10             	add    $0x10,%esp
  803571:	85 c0                	test   %eax,%eax
  803573:	0f 88 82 00 00 00    	js     8035fb <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  803579:	83 ec 0c             	sub    $0xc,%esp
  80357c:	ff 75 f0             	pushl  -0x10(%ebp)
  80357f:	e8 fb f4 ff ff       	call   802a7f <fd2data>
  803584:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  80358b:	50                   	push   %eax
  80358c:	6a 00                	push   $0x0
  80358e:	56                   	push   %esi
  80358f:	6a 00                	push   $0x0
  803591:	e8 54 f1 ff ff       	call   8026ea <sys_page_map>
  803596:	89 c3                	mov    %eax,%ebx
  803598:	83 c4 20             	add    $0x20,%esp
  80359b:	85 c0                	test   %eax,%eax
  80359d:	78 4e                	js     8035ed <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  80359f:	a1 80 90 80 00       	mov    0x809080,%eax
  8035a4:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8035a7:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  8035a9:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8035ac:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  8035b3:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8035b6:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  8035b8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8035bb:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  8035c2:	83 ec 0c             	sub    $0xc,%esp
  8035c5:	ff 75 f4             	pushl  -0xc(%ebp)
  8035c8:	e8 9e f4 ff ff       	call   802a6b <fd2num>
  8035cd:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8035d0:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  8035d2:	83 c4 04             	add    $0x4,%esp
  8035d5:	ff 75 f0             	pushl  -0x10(%ebp)
  8035d8:	e8 8e f4 ff ff       	call   802a6b <fd2num>
  8035dd:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8035e0:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  8035e3:	83 c4 10             	add    $0x10,%esp
  8035e6:	bb 00 00 00 00       	mov    $0x0,%ebx
  8035eb:	eb 2e                	jmp    80361b <pipe+0x145>
	sys_page_unmap(0, va);
  8035ed:	83 ec 08             	sub    $0x8,%esp
  8035f0:	56                   	push   %esi
  8035f1:	6a 00                	push   $0x0
  8035f3:	e8 38 f1 ff ff       	call   802730 <sys_page_unmap>
  8035f8:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  8035fb:	83 ec 08             	sub    $0x8,%esp
  8035fe:	ff 75 f0             	pushl  -0x10(%ebp)
  803601:	6a 00                	push   $0x0
  803603:	e8 28 f1 ff ff       	call   802730 <sys_page_unmap>
  803608:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  80360b:	83 ec 08             	sub    $0x8,%esp
  80360e:	ff 75 f4             	pushl  -0xc(%ebp)
  803611:	6a 00                	push   $0x0
  803613:	e8 18 f1 ff ff       	call   802730 <sys_page_unmap>
  803618:	83 c4 10             	add    $0x10,%esp
}
  80361b:	89 d8                	mov    %ebx,%eax
  80361d:	8d 65 f8             	lea    -0x8(%ebp),%esp
  803620:	5b                   	pop    %ebx
  803621:	5e                   	pop    %esi
  803622:	5d                   	pop    %ebp
  803623:	c3                   	ret    

00803624 <pipeisclosed>:
{
  803624:	f3 0f 1e fb          	endbr32 
  803628:	55                   	push   %ebp
  803629:	89 e5                	mov    %esp,%ebp
  80362b:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80362e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  803631:	50                   	push   %eax
  803632:	ff 75 08             	pushl  0x8(%ebp)
  803635:	e8 b6 f4 ff ff       	call   802af0 <fd_lookup>
  80363a:	83 c4 10             	add    $0x10,%esp
  80363d:	85 c0                	test   %eax,%eax
  80363f:	78 18                	js     803659 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  803641:	83 ec 0c             	sub    $0xc,%esp
  803644:	ff 75 f4             	pushl  -0xc(%ebp)
  803647:	e8 33 f4 ff ff       	call   802a7f <fd2data>
  80364c:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  80364e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  803651:	e8 1f fd ff ff       	call   803375 <_pipeisclosed>
  803656:	83 c4 10             	add    $0x10,%esp
}
  803659:	c9                   	leave  
  80365a:	c3                   	ret    

0080365b <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  80365b:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  80365f:	b8 00 00 00 00       	mov    $0x0,%eax
  803664:	c3                   	ret    

00803665 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  803665:	f3 0f 1e fb          	endbr32 
  803669:	55                   	push   %ebp
  80366a:	89 e5                	mov    %esp,%ebp
  80366c:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  80366f:	68 a5 44 80 00       	push   $0x8044a5
  803674:	ff 75 0c             	pushl  0xc(%ebp)
  803677:	e8 e5 eb ff ff       	call   802261 <strcpy>
	return 0;
}
  80367c:	b8 00 00 00 00       	mov    $0x0,%eax
  803681:	c9                   	leave  
  803682:	c3                   	ret    

00803683 <devcons_write>:
{
  803683:	f3 0f 1e fb          	endbr32 
  803687:	55                   	push   %ebp
  803688:	89 e5                	mov    %esp,%ebp
  80368a:	57                   	push   %edi
  80368b:	56                   	push   %esi
  80368c:	53                   	push   %ebx
  80368d:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  803693:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  803698:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  80369e:	3b 75 10             	cmp    0x10(%ebp),%esi
  8036a1:	73 31                	jae    8036d4 <devcons_write+0x51>
		m = n - tot;
  8036a3:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8036a6:	29 f3                	sub    %esi,%ebx
  8036a8:	83 fb 7f             	cmp    $0x7f,%ebx
  8036ab:	b8 7f 00 00 00       	mov    $0x7f,%eax
  8036b0:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  8036b3:	83 ec 04             	sub    $0x4,%esp
  8036b6:	53                   	push   %ebx
  8036b7:	89 f0                	mov    %esi,%eax
  8036b9:	03 45 0c             	add    0xc(%ebp),%eax
  8036bc:	50                   	push   %eax
  8036bd:	57                   	push   %edi
  8036be:	e8 54 ed ff ff       	call   802417 <memmove>
		sys_cputs(buf, m);
  8036c3:	83 c4 08             	add    $0x8,%esp
  8036c6:	53                   	push   %ebx
  8036c7:	57                   	push   %edi
  8036c8:	e8 06 ef ff ff       	call   8025d3 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  8036cd:	01 de                	add    %ebx,%esi
  8036cf:	83 c4 10             	add    $0x10,%esp
  8036d2:	eb ca                	jmp    80369e <devcons_write+0x1b>
}
  8036d4:	89 f0                	mov    %esi,%eax
  8036d6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8036d9:	5b                   	pop    %ebx
  8036da:	5e                   	pop    %esi
  8036db:	5f                   	pop    %edi
  8036dc:	5d                   	pop    %ebp
  8036dd:	c3                   	ret    

008036de <devcons_read>:
{
  8036de:	f3 0f 1e fb          	endbr32 
  8036e2:	55                   	push   %ebp
  8036e3:	89 e5                	mov    %esp,%ebp
  8036e5:	83 ec 08             	sub    $0x8,%esp
  8036e8:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  8036ed:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  8036f1:	74 21                	je     803714 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  8036f3:	e8 fd ee ff ff       	call   8025f5 <sys_cgetc>
  8036f8:	85 c0                	test   %eax,%eax
  8036fa:	75 07                	jne    803703 <devcons_read+0x25>
		sys_yield();
  8036fc:	e8 7f ef ff ff       	call   802680 <sys_yield>
  803701:	eb f0                	jmp    8036f3 <devcons_read+0x15>
	if (c < 0)
  803703:	78 0f                	js     803714 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  803705:	83 f8 04             	cmp    $0x4,%eax
  803708:	74 0c                	je     803716 <devcons_read+0x38>
	*(char*)vbuf = c;
  80370a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80370d:	88 02                	mov    %al,(%edx)
	return 1;
  80370f:	b8 01 00 00 00       	mov    $0x1,%eax
}
  803714:	c9                   	leave  
  803715:	c3                   	ret    
		return 0;
  803716:	b8 00 00 00 00       	mov    $0x0,%eax
  80371b:	eb f7                	jmp    803714 <devcons_read+0x36>

0080371d <cputchar>:
{
  80371d:	f3 0f 1e fb          	endbr32 
  803721:	55                   	push   %ebp
  803722:	89 e5                	mov    %esp,%ebp
  803724:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  803727:	8b 45 08             	mov    0x8(%ebp),%eax
  80372a:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  80372d:	6a 01                	push   $0x1
  80372f:	8d 45 f7             	lea    -0x9(%ebp),%eax
  803732:	50                   	push   %eax
  803733:	e8 9b ee ff ff       	call   8025d3 <sys_cputs>
}
  803738:	83 c4 10             	add    $0x10,%esp
  80373b:	c9                   	leave  
  80373c:	c3                   	ret    

0080373d <getchar>:
{
  80373d:	f3 0f 1e fb          	endbr32 
  803741:	55                   	push   %ebp
  803742:	89 e5                	mov    %esp,%ebp
  803744:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  803747:	6a 01                	push   $0x1
  803749:	8d 45 f7             	lea    -0x9(%ebp),%eax
  80374c:	50                   	push   %eax
  80374d:	6a 00                	push   $0x0
  80374f:	e8 1f f6 ff ff       	call   802d73 <read>
	if (r < 0)
  803754:	83 c4 10             	add    $0x10,%esp
  803757:	85 c0                	test   %eax,%eax
  803759:	78 06                	js     803761 <getchar+0x24>
	if (r < 1)
  80375b:	74 06                	je     803763 <getchar+0x26>
	return c;
  80375d:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  803761:	c9                   	leave  
  803762:	c3                   	ret    
		return -E_EOF;
  803763:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  803768:	eb f7                	jmp    803761 <getchar+0x24>

0080376a <iscons>:
{
  80376a:	f3 0f 1e fb          	endbr32 
  80376e:	55                   	push   %ebp
  80376f:	89 e5                	mov    %esp,%ebp
  803771:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  803774:	8d 45 f4             	lea    -0xc(%ebp),%eax
  803777:	50                   	push   %eax
  803778:	ff 75 08             	pushl  0x8(%ebp)
  80377b:	e8 70 f3 ff ff       	call   802af0 <fd_lookup>
  803780:	83 c4 10             	add    $0x10,%esp
  803783:	85 c0                	test   %eax,%eax
  803785:	78 11                	js     803798 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  803787:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80378a:	8b 15 9c 90 80 00    	mov    0x80909c,%edx
  803790:	39 10                	cmp    %edx,(%eax)
  803792:	0f 94 c0             	sete   %al
  803795:	0f b6 c0             	movzbl %al,%eax
}
  803798:	c9                   	leave  
  803799:	c3                   	ret    

0080379a <opencons>:
{
  80379a:	f3 0f 1e fb          	endbr32 
  80379e:	55                   	push   %ebp
  80379f:	89 e5                	mov    %esp,%ebp
  8037a1:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  8037a4:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8037a7:	50                   	push   %eax
  8037a8:	e8 ed f2 ff ff       	call   802a9a <fd_alloc>
  8037ad:	83 c4 10             	add    $0x10,%esp
  8037b0:	85 c0                	test   %eax,%eax
  8037b2:	78 3a                	js     8037ee <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  8037b4:	83 ec 04             	sub    $0x4,%esp
  8037b7:	68 07 04 00 00       	push   $0x407
  8037bc:	ff 75 f4             	pushl  -0xc(%ebp)
  8037bf:	6a 00                	push   $0x0
  8037c1:	e8 dd ee ff ff       	call   8026a3 <sys_page_alloc>
  8037c6:	83 c4 10             	add    $0x10,%esp
  8037c9:	85 c0                	test   %eax,%eax
  8037cb:	78 21                	js     8037ee <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  8037cd:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8037d0:	8b 15 9c 90 80 00    	mov    0x80909c,%edx
  8037d6:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  8037d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8037db:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  8037e2:	83 ec 0c             	sub    $0xc,%esp
  8037e5:	50                   	push   %eax
  8037e6:	e8 80 f2 ff ff       	call   802a6b <fd2num>
  8037eb:	83 c4 10             	add    $0x10,%esp
}
  8037ee:	c9                   	leave  
  8037ef:	c3                   	ret    

008037f0 <__udivdi3>:
  8037f0:	f3 0f 1e fb          	endbr32 
  8037f4:	55                   	push   %ebp
  8037f5:	57                   	push   %edi
  8037f6:	56                   	push   %esi
  8037f7:	53                   	push   %ebx
  8037f8:	83 ec 1c             	sub    $0x1c,%esp
  8037fb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8037ff:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  803803:	8b 74 24 34          	mov    0x34(%esp),%esi
  803807:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80380b:	85 d2                	test   %edx,%edx
  80380d:	75 19                	jne    803828 <__udivdi3+0x38>
  80380f:	39 f3                	cmp    %esi,%ebx
  803811:	76 4d                	jbe    803860 <__udivdi3+0x70>
  803813:	31 ff                	xor    %edi,%edi
  803815:	89 e8                	mov    %ebp,%eax
  803817:	89 f2                	mov    %esi,%edx
  803819:	f7 f3                	div    %ebx
  80381b:	89 fa                	mov    %edi,%edx
  80381d:	83 c4 1c             	add    $0x1c,%esp
  803820:	5b                   	pop    %ebx
  803821:	5e                   	pop    %esi
  803822:	5f                   	pop    %edi
  803823:	5d                   	pop    %ebp
  803824:	c3                   	ret    
  803825:	8d 76 00             	lea    0x0(%esi),%esi
  803828:	39 f2                	cmp    %esi,%edx
  80382a:	76 14                	jbe    803840 <__udivdi3+0x50>
  80382c:	31 ff                	xor    %edi,%edi
  80382e:	31 c0                	xor    %eax,%eax
  803830:	89 fa                	mov    %edi,%edx
  803832:	83 c4 1c             	add    $0x1c,%esp
  803835:	5b                   	pop    %ebx
  803836:	5e                   	pop    %esi
  803837:	5f                   	pop    %edi
  803838:	5d                   	pop    %ebp
  803839:	c3                   	ret    
  80383a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  803840:	0f bd fa             	bsr    %edx,%edi
  803843:	83 f7 1f             	xor    $0x1f,%edi
  803846:	75 48                	jne    803890 <__udivdi3+0xa0>
  803848:	39 f2                	cmp    %esi,%edx
  80384a:	72 06                	jb     803852 <__udivdi3+0x62>
  80384c:	31 c0                	xor    %eax,%eax
  80384e:	39 eb                	cmp    %ebp,%ebx
  803850:	77 de                	ja     803830 <__udivdi3+0x40>
  803852:	b8 01 00 00 00       	mov    $0x1,%eax
  803857:	eb d7                	jmp    803830 <__udivdi3+0x40>
  803859:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  803860:	89 d9                	mov    %ebx,%ecx
  803862:	85 db                	test   %ebx,%ebx
  803864:	75 0b                	jne    803871 <__udivdi3+0x81>
  803866:	b8 01 00 00 00       	mov    $0x1,%eax
  80386b:	31 d2                	xor    %edx,%edx
  80386d:	f7 f3                	div    %ebx
  80386f:	89 c1                	mov    %eax,%ecx
  803871:	31 d2                	xor    %edx,%edx
  803873:	89 f0                	mov    %esi,%eax
  803875:	f7 f1                	div    %ecx
  803877:	89 c6                	mov    %eax,%esi
  803879:	89 e8                	mov    %ebp,%eax
  80387b:	89 f7                	mov    %esi,%edi
  80387d:	f7 f1                	div    %ecx
  80387f:	89 fa                	mov    %edi,%edx
  803881:	83 c4 1c             	add    $0x1c,%esp
  803884:	5b                   	pop    %ebx
  803885:	5e                   	pop    %esi
  803886:	5f                   	pop    %edi
  803887:	5d                   	pop    %ebp
  803888:	c3                   	ret    
  803889:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  803890:	89 f9                	mov    %edi,%ecx
  803892:	b8 20 00 00 00       	mov    $0x20,%eax
  803897:	29 f8                	sub    %edi,%eax
  803899:	d3 e2                	shl    %cl,%edx
  80389b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80389f:	89 c1                	mov    %eax,%ecx
  8038a1:	89 da                	mov    %ebx,%edx
  8038a3:	d3 ea                	shr    %cl,%edx
  8038a5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8038a9:	09 d1                	or     %edx,%ecx
  8038ab:	89 f2                	mov    %esi,%edx
  8038ad:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8038b1:	89 f9                	mov    %edi,%ecx
  8038b3:	d3 e3                	shl    %cl,%ebx
  8038b5:	89 c1                	mov    %eax,%ecx
  8038b7:	d3 ea                	shr    %cl,%edx
  8038b9:	89 f9                	mov    %edi,%ecx
  8038bb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8038bf:	89 eb                	mov    %ebp,%ebx
  8038c1:	d3 e6                	shl    %cl,%esi
  8038c3:	89 c1                	mov    %eax,%ecx
  8038c5:	d3 eb                	shr    %cl,%ebx
  8038c7:	09 de                	or     %ebx,%esi
  8038c9:	89 f0                	mov    %esi,%eax
  8038cb:	f7 74 24 08          	divl   0x8(%esp)
  8038cf:	89 d6                	mov    %edx,%esi
  8038d1:	89 c3                	mov    %eax,%ebx
  8038d3:	f7 64 24 0c          	mull   0xc(%esp)
  8038d7:	39 d6                	cmp    %edx,%esi
  8038d9:	72 15                	jb     8038f0 <__udivdi3+0x100>
  8038db:	89 f9                	mov    %edi,%ecx
  8038dd:	d3 e5                	shl    %cl,%ebp
  8038df:	39 c5                	cmp    %eax,%ebp
  8038e1:	73 04                	jae    8038e7 <__udivdi3+0xf7>
  8038e3:	39 d6                	cmp    %edx,%esi
  8038e5:	74 09                	je     8038f0 <__udivdi3+0x100>
  8038e7:	89 d8                	mov    %ebx,%eax
  8038e9:	31 ff                	xor    %edi,%edi
  8038eb:	e9 40 ff ff ff       	jmp    803830 <__udivdi3+0x40>
  8038f0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8038f3:	31 ff                	xor    %edi,%edi
  8038f5:	e9 36 ff ff ff       	jmp    803830 <__udivdi3+0x40>
  8038fa:	66 90                	xchg   %ax,%ax
  8038fc:	66 90                	xchg   %ax,%ax
  8038fe:	66 90                	xchg   %ax,%ax

00803900 <__umoddi3>:
  803900:	f3 0f 1e fb          	endbr32 
  803904:	55                   	push   %ebp
  803905:	57                   	push   %edi
  803906:	56                   	push   %esi
  803907:	53                   	push   %ebx
  803908:	83 ec 1c             	sub    $0x1c,%esp
  80390b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80390f:	8b 74 24 30          	mov    0x30(%esp),%esi
  803913:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  803917:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80391b:	85 c0                	test   %eax,%eax
  80391d:	75 19                	jne    803938 <__umoddi3+0x38>
  80391f:	39 df                	cmp    %ebx,%edi
  803921:	76 5d                	jbe    803980 <__umoddi3+0x80>
  803923:	89 f0                	mov    %esi,%eax
  803925:	89 da                	mov    %ebx,%edx
  803927:	f7 f7                	div    %edi
  803929:	89 d0                	mov    %edx,%eax
  80392b:	31 d2                	xor    %edx,%edx
  80392d:	83 c4 1c             	add    $0x1c,%esp
  803930:	5b                   	pop    %ebx
  803931:	5e                   	pop    %esi
  803932:	5f                   	pop    %edi
  803933:	5d                   	pop    %ebp
  803934:	c3                   	ret    
  803935:	8d 76 00             	lea    0x0(%esi),%esi
  803938:	89 f2                	mov    %esi,%edx
  80393a:	39 d8                	cmp    %ebx,%eax
  80393c:	76 12                	jbe    803950 <__umoddi3+0x50>
  80393e:	89 f0                	mov    %esi,%eax
  803940:	89 da                	mov    %ebx,%edx
  803942:	83 c4 1c             	add    $0x1c,%esp
  803945:	5b                   	pop    %ebx
  803946:	5e                   	pop    %esi
  803947:	5f                   	pop    %edi
  803948:	5d                   	pop    %ebp
  803949:	c3                   	ret    
  80394a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  803950:	0f bd e8             	bsr    %eax,%ebp
  803953:	83 f5 1f             	xor    $0x1f,%ebp
  803956:	75 50                	jne    8039a8 <__umoddi3+0xa8>
  803958:	39 d8                	cmp    %ebx,%eax
  80395a:	0f 82 e0 00 00 00    	jb     803a40 <__umoddi3+0x140>
  803960:	89 d9                	mov    %ebx,%ecx
  803962:	39 f7                	cmp    %esi,%edi
  803964:	0f 86 d6 00 00 00    	jbe    803a40 <__umoddi3+0x140>
  80396a:	89 d0                	mov    %edx,%eax
  80396c:	89 ca                	mov    %ecx,%edx
  80396e:	83 c4 1c             	add    $0x1c,%esp
  803971:	5b                   	pop    %ebx
  803972:	5e                   	pop    %esi
  803973:	5f                   	pop    %edi
  803974:	5d                   	pop    %ebp
  803975:	c3                   	ret    
  803976:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80397d:	8d 76 00             	lea    0x0(%esi),%esi
  803980:	89 fd                	mov    %edi,%ebp
  803982:	85 ff                	test   %edi,%edi
  803984:	75 0b                	jne    803991 <__umoddi3+0x91>
  803986:	b8 01 00 00 00       	mov    $0x1,%eax
  80398b:	31 d2                	xor    %edx,%edx
  80398d:	f7 f7                	div    %edi
  80398f:	89 c5                	mov    %eax,%ebp
  803991:	89 d8                	mov    %ebx,%eax
  803993:	31 d2                	xor    %edx,%edx
  803995:	f7 f5                	div    %ebp
  803997:	89 f0                	mov    %esi,%eax
  803999:	f7 f5                	div    %ebp
  80399b:	89 d0                	mov    %edx,%eax
  80399d:	31 d2                	xor    %edx,%edx
  80399f:	eb 8c                	jmp    80392d <__umoddi3+0x2d>
  8039a1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8039a8:	89 e9                	mov    %ebp,%ecx
  8039aa:	ba 20 00 00 00       	mov    $0x20,%edx
  8039af:	29 ea                	sub    %ebp,%edx
  8039b1:	d3 e0                	shl    %cl,%eax
  8039b3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8039b7:	89 d1                	mov    %edx,%ecx
  8039b9:	89 f8                	mov    %edi,%eax
  8039bb:	d3 e8                	shr    %cl,%eax
  8039bd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8039c1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8039c5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8039c9:	09 c1                	or     %eax,%ecx
  8039cb:	89 d8                	mov    %ebx,%eax
  8039cd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8039d1:	89 e9                	mov    %ebp,%ecx
  8039d3:	d3 e7                	shl    %cl,%edi
  8039d5:	89 d1                	mov    %edx,%ecx
  8039d7:	d3 e8                	shr    %cl,%eax
  8039d9:	89 e9                	mov    %ebp,%ecx
  8039db:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8039df:	d3 e3                	shl    %cl,%ebx
  8039e1:	89 c7                	mov    %eax,%edi
  8039e3:	89 d1                	mov    %edx,%ecx
  8039e5:	89 f0                	mov    %esi,%eax
  8039e7:	d3 e8                	shr    %cl,%eax
  8039e9:	89 e9                	mov    %ebp,%ecx
  8039eb:	89 fa                	mov    %edi,%edx
  8039ed:	d3 e6                	shl    %cl,%esi
  8039ef:	09 d8                	or     %ebx,%eax
  8039f1:	f7 74 24 08          	divl   0x8(%esp)
  8039f5:	89 d1                	mov    %edx,%ecx
  8039f7:	89 f3                	mov    %esi,%ebx
  8039f9:	f7 64 24 0c          	mull   0xc(%esp)
  8039fd:	89 c6                	mov    %eax,%esi
  8039ff:	89 d7                	mov    %edx,%edi
  803a01:	39 d1                	cmp    %edx,%ecx
  803a03:	72 06                	jb     803a0b <__umoddi3+0x10b>
  803a05:	75 10                	jne    803a17 <__umoddi3+0x117>
  803a07:	39 c3                	cmp    %eax,%ebx
  803a09:	73 0c                	jae    803a17 <__umoddi3+0x117>
  803a0b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  803a0f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  803a13:	89 d7                	mov    %edx,%edi
  803a15:	89 c6                	mov    %eax,%esi
  803a17:	89 ca                	mov    %ecx,%edx
  803a19:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  803a1e:	29 f3                	sub    %esi,%ebx
  803a20:	19 fa                	sbb    %edi,%edx
  803a22:	89 d0                	mov    %edx,%eax
  803a24:	d3 e0                	shl    %cl,%eax
  803a26:	89 e9                	mov    %ebp,%ecx
  803a28:	d3 eb                	shr    %cl,%ebx
  803a2a:	d3 ea                	shr    %cl,%edx
  803a2c:	09 d8                	or     %ebx,%eax
  803a2e:	83 c4 1c             	add    $0x1c,%esp
  803a31:	5b                   	pop    %ebx
  803a32:	5e                   	pop    %esi
  803a33:	5f                   	pop    %edi
  803a34:	5d                   	pop    %ebp
  803a35:	c3                   	ret    
  803a36:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  803a3d:	8d 76 00             	lea    0x0(%esi),%esi
  803a40:	29 fe                	sub    %edi,%esi
  803a42:	19 c3                	sbb    %eax,%ebx
  803a44:	89 f2                	mov    %esi,%edx
  803a46:	89 d9                	mov    %ebx,%ecx
  803a48:	e9 1d ff ff ff       	jmp    80396a <__umoddi3+0x6a>
